Output error when input isn't a number. C++

前端 未结 5 1871
野性不改
野性不改 2021-01-28 07:47

I am making a function that takes a number from the user\'s input and finds the absolute value of it. I want to make it return an error if the user inputs anything other than j

5条回答
  •  臣服心动
    2021-01-28 08:26

    Treat user input as std::string or char *, then validate whether it contains a valid digit character.

提交回复
热议问题