Qualche aggiustatina, qua e là ...
Inserito nell'apposito tag [ CODE][ /CODE] il tuo codicecodice:#include <iostream> using namespace std; int main() { const int strlength=20; char str[strlength+1]; int contatore=0, j=0; cout<<"Inserire Stringa (max "<<strlength<<" char) > "; cin.getline( str, strlength); while('\0'!=str[j]) { if ('a'==str[j]) contatore++; j++; } cout<<"\nLa lettera 'a' e' presente nella stringa "<<contatore<<" volta/e"<<endl; system("pause"); return 0; }
si presenta molto meglio, non credi anche tu ?![]()

Rispondi quotando