I am using the flowing code to check if the user entered only numbers.
while(!cin)
{
cout << "You entered something that is not a number. Please try again" << endl;
cout << "Please enter the point on the circle in the form x y: ";
cin.clear();
cin.ignore();
cin >> coordX >> coordY;
cout << endl;
}
It works if the user enters "&". The error is it reprints for every non number character that is entered. For example if (4,2) is entered it would print 3 times. How can I make it only print once?