I'm trying to figure out why i cant take cin our of its failed state. I am getting an infinite loop if i enter a character but i am using cin.clear() to take it out? any suggestions?
1 2 3 4 5 6 7 8 9 10
cout << "How many steps should the somnambulist take (enter a whole number)?\n\n";
cin >> steps;
while(cin.fail())
{
cin.ignore(100,'\n');
cin.clear();
cout << "Please enter the number of steps to take as a whole number)\n";
cin >> steps;
}