can't we use "break" to if statement....??? then, what do i want do to stop the if statement after the results.... beacause, i have written a code with options. one of the options from them is "exit". so, i want to exit the program when i select exit... please help me...... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can't we use "break" to if statement....??? then, what do i want do to stop the if statement after the results.... beacause, i have written a code with options. one of the options from them is "exit". so, i want to exit the program when i select exit... please help me......

8th Aug 2016, 7:42 AM
Mohamed Misfar
Mohamed Misfar - avatar
4 Answers
+ 2
When the user exits, just make the program return 0 from main. That will safely stop the program, just like you want.
8th Aug 2016, 11:14 AM
Cohen Creber
Cohen Creber - avatar
0
u can use try catch block if u want to terminate ur program with a specific code
8th Aug 2016, 8:35 AM
Suhail Pappu
Suhail Pappu - avatar
0
If,,,,else,,,
8th Aug 2016, 10:13 AM
song bohan
song bohan - avatar
0
You can use exit(); function. But in this case it totally comes out of ur program and it does not need any conditions.
8th Sep 2016, 5:17 PM
Bheemesh
Bheemesh - avatar