程序如何知道输入是否为整数? [英] how can the program know if the input is integer?

查看:84
本文介绍了程序如何知道输入是否为整数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C ++中,如何使程序知道输入是否为整数?

例如,如果程序要求用户提供整数或数字,并且用户键入:23ddas.

然后我想回答:请输入一个整数.

In C++ how can I make the program know if the input is an integer?

For example if the program asks for an integer or number from the user and the user types: 23ddas.

Then I want to respond: Please Enter An Integer Number.

推荐答案

是否http://www.cplusplus.com/reference/clibrary/cctype/isdigit/ [

这篇关于程序如何知道输入是否为整数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆