开发者

How to create an "Exit program" command

How could I 开发者_运维百科make a line of code that would exit out of my program after input is given by the user for a specific word?

the psuedo-code of what I have is as follows:

take input;

compare (input) to exit word;

if input is same as exit word

exit the program <------- help here;

else

rest of program;


If the code is inside main, you can simply use return if somewhere else use exit


Use the exit() function.


At the risk of sounding too terse, exit();

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜