|
|
|
|
|
|
The user input I want to limit to strictly characters of the English alphabet, excluding spaces, punctuation, symbols, other language characters, and numbers |
isalpha
function does, although you don't quite have it correct in your program. And because the while is inside the if statement, the program ends if an invalid character is encountered. See my comment below about default:
or else
std::toupper
function to convert the input, then you could have:
|
|
switch
statement:
|
|
default:
case does the same thing as an else
: it catches bad/invalid input. It's a good thing to have.
|
|
Enter a string: 007 Invalid input Enter a string: JamesBond Result: Juliet Alpha Mike Echo Sierra Bravo Oscar November Delta |