Question about vector C++
why does the compiler want me to write 0 to stop the program?
And how to make that you don't have to write zero to stop?
The reason you have to enter 0 to stop the program has to do with your do-while loop
You put input in the while condition, which means that it will be evaluated as a boolean value (true/false) to decide whether to run again or not. Any integer other than 0 evaluates to true in this context, which is why your program keeps running unless you enter 0
This is because C++ your
main() function is returning an
int value. This is an integer. It expects a
return statement returning any integer value in order to properly execute the program. This is built in to C++
Please mark this as the answer if I answered your question :)