do{
cout << "How many people are in the party? ";
cin >> size;
if(size > 0 && size <= 500)
{
correctSize = true;
}
else
{
cout << "Party size must be a whole number and greater than zero. Please try again. " << endl;
correctSize = false;
cin.clear();
cin.ignore();
size = 0;
}
}while(!correctSize);
It almost does what I need it to do. When I enter one letter or symbol it prints out the try again message. But when I enter two letters or symbols it prints the message out twice and so on. I have done different things with cin.clear and ignore but they haven't worked. Anyone know how I can fix this?