- Missing parentheses (quarters > 0), also there is no
then statement in C++
- Unbalanced parentheses around condition, use: if (1 + x >
pow(x, sqrt(2))) y = y + x;
- (x = 1) and (x = 2) are assignments, not
comparisons, use (x == 1) and (x == 2) instead.
- Doesn't make sense to form and of x and y.
Should be if (x == 0 and y == 0)
- Invalid condition, use if(1 <= x and x <= 10)
instead.
- There is no way for the condition to evaluate true. s cannot
simultaneously be not equal to nick, penn, dime or quar. If s must be
one of the choices, use the following instead:
if (s != "nick" and s != "penn" and s != "dime" and s != "quar")
cout << "Input error !");
- Can't form or of two strings. Instead, use
if (input == "N" or input == "NO")
. . .
- Attempts to use the value for x read from a failed input stream. Use
if (!cin.fail()) ...
- Braces are needed to make the test for country == "China"
work properly. Use the following insteadl
language = "English";
if (country == "USA")
{ if ( state == "PR")
language = "Spanish";
}
else if (country == "China")
language = "Chinese";