Untitled
unknown
plain_text
3 years ago
893 B
21
Indexable
cout << "Enter name and press '.' at the end:" << endl;
bool strValid = false;
char temp = ' ';
do
{
char inputChar = getc(stdin);
if ((inputChar > 'A' && inputChar < 'a') || inputChar < 'Z')
{
strValid = true;
}
else
{
strValid = false;
cout << "Try again:" << endl;
}
inputChar = getc(stdin);
while (inputChar != '/n' || inputChar != EOF)
{
if ((inputChar < 'a' && inputChar != '.') || inputChar>'z')
{
strValid = false;
break;
}
char temp = inputChar;
inputChar = getc(stdin);
}
if (temp != '.')
{
strValid = false;
}
} while (!strValid);
cout << "Good Job" << endl;
return 0;Editor is loading...