0

Why whis xode doesn't work?

I create a code, but it doesn't work Help https://code.sololearn.com/c95s9vzb2Cpa/?ref=app

21st Jun 2019, 12:45 PM
SenexBey
SenexBey - avatar
1 Odpowiedź
+ 3
First, your parentheses are wrong. Your code looks like this: if(a > balance) { return 0; if(win != 1) { if(win != 2) { } } } So everything will only be executed if a is > balance. Since you're using a return statement in line 16, nothing that comes after this line will ever be executed. It needs to look like this: if(a > balance) { // do_something return 0; } if(win != 1) { // do_something } if(win != 2) { // do_something } Second, the conditions if(win != 1) look wrong to me. You probably want to do this: if(win == 1) { // do_something } else if( win == 2) { // do_something } else { // do_something } Third, remove the "int" from line 22.
21st Jun 2019, 1:44 PM
Anna
Anna - avatar