vendredi 30 octobre 2020

How to replace input within a loop

bool alphabeticString(string word)
{
for (int i = 0; i < word.length(); i++)
{

    if (isalpha(word[i])==true)
    {
        cout << word[i] << " is alphabetical\n";
        
    }
    
    if (isalpha(word[i])==false) {
        cout << "Please retry a character is not alphabetical\n";
        cin >> word;
    }

}
return true;
}

Trying to make the word variable become the new loop if a character isn't alphabetical

Aucun commentaire:

Enregistrer un commentaire