由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - how to let cin get enter
相关主题
有人能解释一下这段C++代码吗如何实现N层循环嵌套
some problems with "cin"Perl 6 改动很大很恶心
one question about algorithm一个读用户输入的小问题
A problem on string parsing (using either grep or perl)[合集] i++ * i++?
how to assign new value to loop variables?C语言中关于fseek和fscanf/fgets的怪事。
LabVIEW问题:对高手来说很简单!陈硕是不是国内cpp最牛人?
请教一道练习题(C,OS)看来Apple hire by reputation
【包子求助】20M*20M的loop怎么搞?Usage of Grep???help!!!
相关话题的讨论汇总
话题: cin话题: enter话题: get话题: let话题: use
进入Programming版参与讨论
1 (共1页)
w*****j
发帖数: 49
1
if i wrote something like while(cin>>n){...}
how do i hit enter to let the loop end?
d****p
发帖数: 685
2
you can hit ctrl-D then enter to quit the loop.
However, this is bad code.
Use cin.get() or cin.getline() instead of cin>> if you don't know
how many times you are gonna read.
w*****j
发帖数: 49
3
thanks, but if i use cin.get(), will cin get a charactor or a float or what?
how can i control that?

know

【在 d****p 的大作中提到】
: you can hit ctrl-D then enter to quit the loop.
: However, this is bad code.
: Use cin.get() or cin.getline() instead of cin>> if you don't know
: how many times you are gonna read.

X****r
发帖数: 3557
4
"get()" extracts *unformatted* data from the stream as character
or characters.
You seem to have lots of questions on istream. Why don't you just
read through the document for once? It only takes 15 minutes and
it would save lot of your time on these questions.

what?

【在 w*****j 的大作中提到】
: thanks, but if i use cin.get(), will cin get a charactor or a float or what?
: how can i control that?
:
: know

1 (共1页)
进入Programming版参与讨论
相关主题
Usage of Grep???help!!!how to assign new value to loop variables?
Excel MarcoLabVIEW问题:对高手来说很简单!
What language I should use?请教一道练习题(C,OS)
How to encode YYYY-MM-DD?【包子求助】20M*20M的loop怎么搞?
有人能解释一下这段C++代码吗如何实现N层循环嵌套
some problems with "cin"Perl 6 改动很大很恶心
one question about algorithm一个读用户输入的小问题
A problem on string parsing (using either grep or perl)[合集] i++ * i++?
相关话题的讨论汇总
话题: cin话题: enter话题: get话题: let话题: use