停止一个循环 [英] Stopping a while loop

查看:74
本文介绍了停止一个循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码段将名称转换为电话簿foremat。

The following code snippet transforms names into telephone book foremat.

展开 | 选择 | Wrap | 行号

推荐答案

如果没有语句,它显然会继续循环,直到n = 35.如果你希望它在那之前停止,你需要某种if语句/ switch / something和break。你究竟想做什么,当用户停止输入名字时停止打印?


另外,如果你在Linux / Unix / Cygwin / etc上,Ctrl-Z不会杀死这个过程,它会暂停它。请改用Ctrl-C.
Without that if statement, it will obviously continue looping until n = 35. If you want it to stop before then, you''ll need some kind of if statement/switch/something and break. What exactly are you trying to do, make it stop printing when the user stops entering names?

Also, if you''re on Linux/Unix/Cygwin/etc, Ctrl-Z does not kill the process, it pauses it. Use Ctrl-C instead.


我的操作系统是XP家。 Ctrl + C将我从DOS屏幕返回到IDE。

是的我只想打印输入的名称而不是最后一个的额外副本。谢谢你的兴趣。
My OS is XP home. Ctrl+C returns me from the DOS screen to the IDE.
Yes I just want to print the names which are input not extra copies of the last one. Thanks for your interest.


伙计,扫管笏你想在这里做点什么,

u尝试用户名34次,是对吗? ?????

为什么你对代码有疑问,对我来说似乎很好....
dude,wat are u trying to do here,
u trying to take in names frm the users 34 times,is tht right???????
why do u have a prob wit the code,it seems Fine to me....


这篇关于停止一个循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆