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

前端 未结 5 1844
野性不改
野性不改 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:16

    Have you checked out atoi, or the even better strtol? I recommend starting there.

提交回复
热议问题