I have a homework that, the user input should be only lowercase. If the word has a uppercase i should give a error message and ask again in a loop.
We only learnt strings and loops. My teacher wants that only using with find() function and in a loop.
I can not use char [] or others.
Can you help me?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
string a = "A";
for (unsignedint s =0 ; s <name1.length(); s++)
{
if ( name1.find("A") == string ::npos)
{
cout<<"ok";
}
else
{
cout <<"The input is invalid! "<<endl;
cout <<"Enter a new input1" ;
cin>>name1;
}
I did something like that. I know that wrong i have to check input all A-Z.