Hdu 2027 - 统计元音
来源:互联网 发布:五线谱制作软件 编辑:程序博客网 时间:2024/05/24 05:29
统计每个元音字母在字符串中出现的次数。
a:num1
e:num2
i:num3
o:num4
u:num5
多个测试实例之间由一个空行隔开。
请特别注意:最后一块输出后面没有空行:)
2aeioumy name is ignatius
a:1e:1i:1o:1u:1a:2e:1i:3o:0u:1
水题~注意输出格式,最后一次输出没有空行。
代码如下:
#include<stdio.h> #include<string.h> int main(){int i, n,len,num1,num2,num3,num4,num5;char a[100];scanf("%d", &n);getchar();while (n--){num1 = num2 = num3 = num4 = num5 = 0;gets(a);len = strlen(a);for (i = 0; i < len; i++){if (a[i] == 'a') num1++;if (a[i] == 'e') num2++;if (a[i] == 'i') num3++;if (a[i] == 'o') num4++;if (a[i] == 'u') num5++;}printf("a:%d\n", num1);printf("e:%d\n", num2);printf("i:%d\n", num3);printf("o:%d\n", num4);printf("u:%d\n", num5);if (n != 0) printf("\n");}return 0;}
0 0
- hdu 2027 统计元音
- HDU 2027 统计元音
- HDU 2027 统计元音
- Hdu 2027 - 统计元音
- HDU 2027 统计元音
- HDU 2027 统计元音
- HDU 2027 统计元音
- HDU 2027 统计元音
- HDU 2027 - 统计元音
- hdu-2027-统计元音
- [hdu 2027] 统计元音
- HDU 2027 统计元音
- HDU 2027 统计元音
- HDU 2027 统计元音
- hdu 2027 统计元音
- HDU 2027 -- 统计元音
- HDU 2027 统计元音
- HDU 2027 统计元音
- Struts2-13 输入验证
- 计算字符串最后一盒单词的长度,单词以空格隔开。
- 前端面试易考知识点
- matlab中num2str控制空格数及其他用法
- 单例模式
- Hdu 2027 - 统计元音
- 代码--
- 启动redis出现Creating Server TCP listening socket *:6379: bind: No such file or directory
- win10+VS2015+SuperBible5源码环境
- RCP中showView方法的说明
- 分页显示列表实例
- linux中find用法十五例
- centos6.5启动报错:系统文件检查出错
- web前端下拉框技术(js)