输入流与C ++中的getline

时间:2013-03-17 20:13:02

标签: c++

我有一个字符数组char input[11];。我有一个循环:

do {
  is >> input;      // is is an input stream defined by istream& is
} while (something)
// works fine

do {
  is.getline(input, 11);
} while (something)
/* i enter 10 digits and press enter, cursor still blinks,
i enter another value and finally it proceeds to the next piece of code */

两者有什么区别,为什么一个人读了所有11个字符(10位+输入)而另一个是悬挂?

0 个答案:

没有答案