Find the errors in the following if statements.a.if x > 0 then cout << x;b.if (x > 0) ; { y = 1; } else ; { y = -1; }c.if (1 + x > pow(x, sqrt(2)) { y = y + x; }d.if (x = 1) { y++; }e.cin >> x; if (cin.fail()) { y = y + x; }
R3.1 Find the errors in the following if statements.
a. if then
;
b. if ;
else ;
c. if
d. if
e.
Step By Step Solution
Step 1 of 5
if then
;
Syntax error. There is an extraneous then which is not part of the C++ syntax.
We can rewrite the code as follows: