Hi ! I'm new to c++ and whole programming stuff.. I've created small program with loop while. Could you explain me why does this program work but the loop doesnt ? And how can i repair it ?
your return statement is in your while loop.
So your while loop is executed once und then it ends because of the return 0;
Please get better style for braces, then you would have seen your mistake by yourself
Thanks, i will try to
Why are there so many third world shitters on this site now?
As a note you probably want to test your expression AFTER your loop (do while) since the user will always give at least one number.
>>53913278
>var names in shit language
stop that shit right now
>>53913278
The while loop is missing a closing brace. How does Code Blocks not catch this?
>>53913278
>not returning 5 because you are so random
>I shiggy diggy
its my second program actually.
- Var only in english
what else should i remember ?
>>53913396
It's not. Grow some eyes.
>>53913278
Pretty-print your code better, fagtron.
It's people like you that cause Python to be used in introductory classes.
Fags that can't keep their code stylistically clean are why stupid people have so much trouble keeping track of scope.
>>53913427
Programm in english and get a standard stlye for braces
When you testwhile(strzal!=liczba)
strzal isn't initialized, like the other anon said you need to use a do while, so you can get a number in and then test it, otherwise it can be any random crap before being initialized
The program terminates inside the while loop, in c++ you don't actually have to explicitly return 0 in the main function
>>53913458
i've tested the do...while and it worked.
but once i've taken out the "return" out of the loop it worked
Indent your code properly.