Find Error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Find Error

Run code only on cppdroid plz[install from play store] https://code.sololearn.com/cMkeUI808ldo/?ref=app

6th Jun 2018, 12:42 PM
Sakaar Sen
Sakaar Sen - avatar
4 Answers
+ 3
Just #include <stdlib.h> and use exit(0); anywhere you want to exit the program
6th Jun 2018, 1:09 PM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 1
Found this: https://stackoverflow.com/questions/14274225/statement-goto-can-not-cross-variable-definition I wouldn't use goto for this purpose, there are much better and cleaner ways to exit the program: http://www.cplusplus.com/reference/cstdlib/exit/
6th Jun 2018, 12:58 PM
Aaron Eberhardt
Aaron Eberhardt - avatar
0
not able to understand..Can u give an example for better ways to exit in this program!!?
6th Jun 2018, 1:07 PM
Sakaar Sen
Sakaar Sen - avatar
0
thx..Will test if it works
6th Jun 2018, 1:10 PM
Sakaar Sen
Sakaar Sen - avatar