Alrighty, nothing special here... just trying to figure out what's up with the if statement in the code below. I've looked around, seems like I've formatted it correctly, but I always get an "illegal else without matching if" error along with "Expected a statement". Every instance of someone having this error that I've seen comes from putting a semicolon at the end of the if statement, but it looks like I'm clear on that...
Only the statement that directly follows the if () is part of the if statement so in your code line 13 is part of the if statement but line 14 is not. If you want multiple statements to be part of the if statement you can use { } to create a compound-statement, like this:
1 2 3 4 5
if (cin.fail())
{
cin.clear();
cout << "That's not a number." << endl;
}