3240:【例40.1】 字符类型判断
[例40.1] 字符类型判断
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 奖学金
【洛谷-P1106的Python方法】
【洛谷-P1106的Python方法】_python输入两行正整数。 第一行输入一个高精度的正整数 n。 第二行输入一个正整数-CSDN博客
洛谷 python P1115 最大子段和
[洛谷] P1150 Peter的烟 Python
洛谷 P1157 组合的输出 Python题解
洛谷 python P1164 小A点菜
python解洛谷入门题P1179、P1200、P1304、P1307、P1317、P1319、P1320、P1321、P1420、P1421
洛谷pythonP1228 地毯填补问题 分治
洛谷 P1307 [NOIP2011 普及组] 数字反转
简单字符串——洛谷#P1308 统计单词数(Python实现)