罗迎甲 • 5个月前
Online Judge
×提交成功
字符类型
判断一个字符是哪种类型.
输入一个ASCII字符.
1. 如果字符是大写字母, 元音输出"Upper Vowel", 其他情况输出"Upper Letter". (字母中, 'a', 'e', 'i', 'o', 'u'是元音字母(不区分大小写))
2. 如果字符是小写字母, 元音输出"Lower Vowel", 其他情况输出"Lower Letter".
3. 如果字符是数字, 输出"Digit".
4. 字符是其他类型, 输出"Other".
input
B
output
Upper Letter
lema
Time limit | 1 second |
Memory limit | 128 MB |
提交记录
刚刚 | Accepted | |
3分钟前 | Compile Error |
×
Run ID:103350
提交时间:2024-12-28 16:17:58
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int a; char a; cin>>a; if(a>='A'&&a<='Z'){ if(a=='A'||b=='E'||c=='I'||d=='O'||e=='U') cout<<"Upper Vowel"; else cout<<"Upper Letter"; }else if(a>='a'&&a<='z'){ if(a=='a'||b=='e'||c=='i'||d=='o'||e=='u') cout<<"Lower Vowel"; else cout<<"Lower Letter";} else if(a>='0'&&a<='9') cout<<"Digit"; else cout<<"Other"; return 0; }
© C++题库系统 OJ 2024
评论: