Check if the input is a number or string in C++

前端 未结 7 506
没有蜡笔的小新
没有蜡笔的小新 2020-12-10 06:16

I wrote the following code to check whether the input(answer3) is a number or string, if it is not a number it should return \"Enter Numbers Only\" but it returns the same e

7条回答
  •  情歌与酒
    2020-12-10 07:10

    The interest phenomenon are the isdigit requires char to be cast to unsigned char. (Also see here).

提交回复
热议问题