+ 1
What is wrong with my code?
Hey guys, First of all thank you for your time in reading this. Being straight to the point, why doesn't my code work what am i missing below? #include <iostream> using namespace std; int main() { int a = 45; int b = a; cout << b + a << endl; cout << "whats happening \n"; cout << "everyone"; return 0; } { int maxsize; cin >> maxsize; if (maxsize > 200){ cout << "its ok go through \n"; if (maxsize < 200){ cout << "all good mate go through"; } } else{ cout << "Im afraid it's too big and it won't go in"; return 0; }
7 Answers
+ 2
+ 1
everything has to reside within your main function or another function, everything after the } after return zero is out of scope and wont be executed so just move that big chunk into the function main and put return 0; } at the very end.
thats just one error though i didnt check for anything else you can post your code so we can edit and further help you!
+ 1
Hey guys thank you for the answers!
Here is the link to my code. https://code.sololearn.com/cLx112pxLkXQ/#cpp
+ 1
Hey Guys thank you for correcting my code.
And thank you for pin pointing where i did wrong Robert.
0
I caught the error.
Please post your code link so I can improve the code and help you.
0
If this helps
https://code.sololearn.com/cZWup65fTt99/?ref=app
0
Tiago Silva anytime :)