Petit problème d'erreur non identifiée par moi;

Fermé
glock - 2 nov. 2012 à 18:52
fiddy Messages postés 11069 Date d'inscription samedi 5 mai 2007 Statut Contributeur Dernière intervention 23 avril 2022 - 2 nov. 2012 à 18:59
Bonsoir à tous !

Tout est dans le titre, j'ai une ***** erreur qui apparaît quand je compile mais pas moyen de savoir ou ça pêche ! Voici mon code :

#include <iostream>
#include <string>

using namespace std;

/*
J'écris une fonction valide qui prend une chaine en parametre, et qui
renvoie true si la chaine contient une chaine ADN, et false sinon.

La chaine est bien une chaine ADN si elle contient
uniquement les caracteres A, C, G ou T
*/
bool testadn(string adn)
{
for (unsigned int i(0); i<= adn.length; i++)
{
if (adn[i]!='A' and 'C' and 'G' and 'T')
{
return false;
}
return true;
}



<config>Linux / PRECISE PANGOLIN (Ubuntu 12.04 LTS)

1 réponse

fiddy Messages postés 11069 Date d'inscription samedi 5 mai 2007 Statut Contributeur Dernière intervention 23 avril 2022 1 835
2 nov. 2012 à 18:59
if (adn[i]!='A' and 'C' and 'G' and 'T')
if (adn[i]!='A' && adn[i]!='C' && adn[i]!='G' && adn[i]!='T')

Ca sera mieux.
0