首页 > 学院 > 开发设计 > 正文

算法训练 判定数字

2019-11-08 00:52:53
字体:
来源:转载
供稿:网友
 算法训练 判定数字  编写函数,判断某个给定字符是否为数字。样例输入9样例输出yes#include <iostream>#include <cctype> using namespace std;int main() {char c;cin >> c;if(isdigit(c)) {  //isdigit(c)用来判定输入的字符是否为数字,该函数在头文件#include <cctype> 中  cout << "yes";} else {cout << "no";}return 0;}
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表