How to end loop??

I need to prompt the user for a word, and repeat the prompt until the input given has no non-whitespace characters. How would I set up that loop?

1
2
3
4
5
6
7
8
9
std::string word;

do
{
	std::cout << "Enter a word: ";
	std::getline( std::cin, word );
} while ( word.empty() );

std::cout << word << std::endl;
Topic archived. No new replies allowed.