我有一个字符数组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 个数字 + 回车)而另一个悬空?