c++中的cin.get函数

今天自己搜了一下这个函数的用法,没有完全看懂。有对这个函数理解较深的帮我解释一下这个函数吗?

img

img


第一张图片是输入字符串之后按了回车。

第二张图片是输入字符串之后按了回车然后再输入字符串再按回车。

https://en.cppreference.com/w/cpp/io/basic_istream/get

int_type get();
Reads one character and returns it if available. Otherwise, returns Traits::eof() and sets failbit and eofbit.

basic_istream& get( char_type* s, std::streamsize count );
Same as get(s, count, widen('\n')), that is, reads at most count-1 characters and stores them into character string pointed to by s until '\n' is found.

你这么理解,第一个cin.get 需要以回车结束,这个没问题吧
第二个,cin.get 函数要回车结束
所以,你是连续按两次