首页 > 其他 > 详细

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

时间:2016-06-02 19:43:46      阅读:240      评论:0      收藏:0      [点我收藏+]

题意: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;
}

 

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

原文:http://www.cnblogs.com/dwtfukgv/p/5553982.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!