3240:【例40.1】 字符类型判断

839 篇文章 36 订阅
660 篇文章 3 订阅

3240:【例40.1】 字符类型判断

信息学奥赛一本通-编程启蒙(C++版)在线评测系统

[例40.1] 字符类型判断

信息学奥赛一本通-编程启蒙(C++版)在线评测系统




C语言:

/*
3240:【例40.1】 字符类型判断
http://bas.ssoier.cn:8086/problem_show.php?pid=3240
*/
#include <stdio.h>
#include <stdlib.h>

int main( void )
{
	char ch;
	ch=getchar();
	
	if( ch<='Z' && ch>='A')
	{
		printf("upper\n");
		return 0;
	}
	
	if( ch<='z' && ch>='a')
	{
		printf("lower\n");
		return 0;
	}
	
	if( ch<='9' && ch>='0')
	{
		printf("digit\n");
		return 0;
	}
	
	printf("other\n");
	
	return 0;
}



C++代码:

/*
3240:【例40.1】 字符类型判断
http://bas.ssoier.cn:8086/problem_show.php?pid=3240
*/
#include <bits/stdc++.h>
using namespace std;
int main( void )
{
	char ch;
	ch=getchar();
	
	if( ch<='Z' && ch>='A')
	{
		cout<<"upper"<<endl;
		return 0;
	}
	
	if( ch<='z' && ch>='a')
	{
		cout<<"lower"<<endl;
		return 0;
	}
	
	if( ch<='9' && ch>='0')
	{
		cout<<"digit"<<endl;
		return 0;
	}
	
	cout<<"other"<<endl;
	
	return 0;
}


#include<iostream>
using namespace std;
int main(){
	char s;
	cin>>s;
	if(s>='a'&&s<='z')cout<<"lower";
	else if(s>='A'&&s<='Z')cout<<"upper";
	else if(s>='0'&&s<='9')cout<<"digit";
	else cout<<"other";
	return 0;
}



 




【洛谷习题】P1093 奖学金

【洛谷习题】P1093 奖学金_python 洛谷 p1093-CSDN博客

【洛谷-P1106的Python方法】

【洛谷-P1106的Python方法】_python输入两行正整数。 第一行输入一个高精度的正整数 n。 第二行输入一个正整数-CSDN博客

洛谷 python P1115 最大子段和

洛谷 python P1115 最大子段和_pythonp1115 最大子段和-CSDN博客

[洛谷] P1150 Peter的烟 Python

[洛谷] P1150 Peter的烟 Python_洛谷p1150-CSDN博客

洛谷 P1157 组合的输出 Python题解

洛谷 P1157 组合的输出 Python题解_p1157python-CSDN博客

洛谷 python P1164 小A点菜

洛谷 python P1164 小A点菜_p1164 小a点菜python-CSDN博客

python解洛谷入门题P1179、P1200、P1304、P1307、P1317、P1319、P1320、P1321、P1420、P1421

python解洛谷入门题P1179、P1200、P1304、P1307、P1317、P1319、P1320、P1321、P1420、P1421_p1179 [noip2010 普及组] 数字统计python-CSDN博客

 




洛谷pythonP1228 地毯填补问题 分治

洛谷pythonP1228 地毯填补问题 分治_洛谷p1228-CSDN博客

洛谷 P1307 [NOIP2011 普及组] 数字反转

洛谷 P1307 [NOIP2011 普及组] 数字反转-CSDN博客

简单字符串——洛谷#P1308 统计单词数(Python实现)

简单字符串——洛谷#P1308 统计单词数(Python实现)_洛谷p1308python-CSDN博客

  • 4
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

dllglvzhenfeng

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值