HDU 3079 Vowel Counting (水题。。。判断元音)

时间:2022-10-10 03:40:21

题意:n个字符串,如果元音就是输出大写,否则输出小写。

析:没啥可说的,只要判断AEIOU就OK了。

代码如下:

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <cstring>
#include <map>
#include <cctype> using namespace std;
const int maxn = 70;
char s[maxn]; bool judge(char ch){
if('A' == towupper(ch) || 'E' == towupper(ch) || 'I' == towupper(ch) || 'O' == towupper(ch) || 'U' == towupper(ch))
return true;
return false;
} int main(){
int T;
scanf("%d", &T);
while(T--){
scanf("%s", s);
int n = strlen(s);
for(int i = 0; i < n; ++i)
if(judge(s[i])) printf("%c", towupper(s[i]));
else printf("%c", towlower(s[i]));
printf("\n");
}
return 0;
}