1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| #include <iostream>
#include <string>
using namespace std;
int main(){
char a('a'), b('b'), c('c'), d('d'), e('e'), f;
int aA(0), bB(0), cC(0), dD(0), eE(0);
bool stator = true;
while ( stator )
{
cin >> f;
if ( f == a ){ aA++; cout << "il y a " << aA << " a. " << endl; }
else if ( f == b ){ bB++; cout << "il y a " << bB << " b. " << endl; }
else if ( f == c ){ cC++; cout << "il y a " << cC << " c. " << endl; }
else if ( f == d ){ dD++; cout << "il y a " << dD << " d. " << endl; }
else if ( f == e ){ eE++; cout << "il y a " << eE << " e. " << endl; }
else { cout << "rien" << endl; }
cout << ">";
}
return 0;
} |
Partager