the code is in french but that's not the problem ,
string PseudoOK;
cout << "votre pseudonyme est: " << pseudo << ", confirmer? Y/N"<< endl;
getline(cin, PseudoOK);
{
if(PseudoOK == "Y" )
{
cout << "bon jeu !" << endl;
}
else if(PseudoOK == "N")
{
cout << "relancer le jeu pour recommencer" << endl;
}
else
{
cout << "reponse invalide , merci de relancer le jeu :)" << endl;
}
return 0;
}
and i whant a while somwhere so the program keep asking Y or N untill the user write Y or N.
cin may represent not only a keyboard but also a f.e. a disk file or an input from a scanner, ... This devices - even a keyboard - may produce errors. A keyboard may be unplugged from your computer while typing, a disk may be corrupt, ... This final conditional statement does handle this fact by reporting an error message to cerr. cerr is the standard error channel, which usually is your display but may also be a log file or a printer, ...