0

what did i do wrong with if else

#include <iostream> using namespace std; int main() { int a = 54; int b = 55; if(a > b); { cout <<"congrats"; } else { cout <<"dead"; } return 0; } what did i do wrong?

16th Feb 2017, 10:27 PM
JuLLe //Rq
JuLLe //Rq - avatar
3 Answers
+ 4
after the if condition you have to erase the ";"
16th Feb 2017, 10:35 PM
C.E.
C.E. - avatar
0
if(a > b); no ; needed here
16th Feb 2017, 10:35 PM
Michael W
Michael W - avatar
0
The comma used after the if logical expression means the if should do nothing
22nd Feb 2017, 7:52 PM
Alkassim Shuaibu Babangida
Alkassim Shuaibu Babangida - avatar