Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
893 B
14
Indexable
Never
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;