|
发表于 2021-3-16 15:04:57
|
显示全部楼层
那我来看看你吧,这个其实要你看scanf()这个函数的原型去看他的返回值了,你可以参考这个网站: https://www.cplusplus.com/reference/cstdio/scanf/
有用的信息就是return value :
Return Value
On success, the function returns the number of items of the argument list successfully filled. This count can match the expected number of items or be less (even zero) due to a matching failure, a reading error, or the reach of the end-of-file.
If a reading error happens or the end-of-file is reached while reading, the proper indicator is set (feof or ferror). And, if either happens before any data could be successfully read, EOF is returned.
If an encoding error happens interpreting wide characters, the function sets errno to EILSEQ.
意思就是说,如果成功会返回成功输入的个数,scanf() == 1,就说明成功输入了一项。
|
|