hello , i have a some problem , if i write yes or no programme working succesfull but if i dont write yes or no i mean if i write anything else programme say "please write yes or no" yes i want to do that but if i will write again yes or no programme say again "please write yes or no"
Hey ! Welcome our programme
Do you want to register = asdasd
please write yes or no = yes
please write yes or no = no
please write yes or no = no
please write yes or no = yes
please write yes or no = asd
please write yes or no = asdasdasd
You should have only one return 0; in your program, and it should be at the end of your main function. Otherwise you're exiting the program within all your if statements..
It's perfectly fine to have multiple return 0;. In fact, it is common during the program driver's startup phase to exit early if you receive invalid input, the user send a command to stop early (like "no" in this case), or a required resource couldn't be acquired.
To be pedantic I would return 1 or 2 in the case of failure :P
It can actual matter if you rely on the return values for scripts.
But yeah, not a big deal.
Right, I was more referring to the act of returning than the value. 0 should be used for successful exits (which appears to be the case here) and > 0 for errors.