#include <iostream>
#include <limits>
#include <cctype>

int main()
{
	int age;
	char c;
	while( !( std::cin >> age ) || ( std::cin.get(c) && c != '\n' ) )
	{
	    std::cout << "invalid input, please try another: ";
    	std::cin.clear(); //clear the bufer
    	std::cin.ignore( std::numeric_limits<std::streamsize>::max() , '\n' ); //ignore anything that might be left in the buffer
	}
	
	std::cout << std::endl << std::endl << "You entered: " << age << std::endl;
	return 0;
}