. Using a do-while loop, write a C++ program to check that the user has typed a letter. The program must not stop until the user types a lowercase or uppercase letter.
#include <iostream>
int main()
{
char ch= '\0';
do
{
std::cout << "Please enter a letter\n";
std::cin >> ch;
} while (!std::isalpha(ch));
return 0;
}
Comments
Leave a comment