0

Can you guys help me find my error

(i will link the code in the comments) I know this can be done with switch statement but im out of practice with if statements in cpp.

11th Jun 2019, 11:02 PM
Kirsten Leonard
Kirsten Leonard - avatar
6 Answers
+ 6
I also noticed on line 15 you have an extra cout << as seen below: ---- cout<< cout<<"You picked....Slushies"<<endl; ---- It should be: ---- cout<<"You picked....Slushies"<<endl; ----
12th Jun 2019, 12:17 AM
David Carroll
David Carroll - avatar
+ 6
Nothing to be embarrassed about. You'll develop an eye for this over time. Glad we could help. 😉👌
12th Jun 2019, 12:30 AM
David Carroll
David Carroll - avatar
+ 5
Your if statements should refer to the variable `x` instead of `int`: It should be: if(x == 1) {...} Instead of: if(int == 1){...}
12th Jun 2019, 12:07 AM
David Carroll
David Carroll - avatar
+ 3
I could be wrong, but it looks like else if statements are not supported, only if statements and else statements are. Nest them to complete your code Edit: Thank God for David Carroll, how did I miss that? 😂 Also, it looks like else if statements do work. Well, I tried. 😃
11th Jun 2019, 11:59 PM
Pete Cowling
Pete Cowling - avatar
+ 1
Peter C... David Carroll thanks you both for your input. I fixed the rather embarrassing mistakes in my code lol. Changing int to x and removing the extra cout seems to have it running properly.
12th Jun 2019, 12:23 AM
Kirsten Leonard
Kirsten Leonard - avatar
11th Jun 2019, 11:03 PM
Kirsten Leonard
Kirsten Leonard - avatar