C++: how do I check if the cin buffer is empty?

后端 未结 4 446
梦谈多话
梦谈多话 2020-12-23 20:08

How do you check to see if the user didn\'t input anything at a cin command and simply pressed enter?

4条回答
  •  無奈伤痛
    2020-12-23 21:00

    cin will not continue with the program unless the user enters at least 1 character (enter doesn't count). If the user doesn't give ANY input, cin will just keep waiting for the user to give input and then press enter.

提交回复
热议问题