HDU-2027 统计元音
来源:互联网 发布:python ggplot 保存 编辑:程序博客网 时间:2024/06/05 19:03
2016-07-06
HDU-2027 统计元音
题目大意:统计每个元音字母在字符串中出现的次数。
解题思路:遍历并统计。
#include <iostream>#include <stdio.h>using namespace std;int main() { int n; int num[5] = {0,0,0,0,0}; char str[100]; cin >> n; getchar(); for (int i = 0; i < n; i++) { cin.getline( str , 100 , '\n' ); for (int j = 0; str[j] != '\0'; j++) { switch (str[j]) { case 'a': num[0]++; break; case 'e': num[1]++; break; case 'i': num[2]++; break; case 'o': num[3]++; break; case 'u': num[4]++; break; } } cout << "a:" << num[0] <<endl; cout << "e:" << num[1] <<endl; cout << "i:" << num[2] <<endl; cout << "o:" << num[3] <<endl; cout << "u:" << num[4] <<endl; if ( i != n-1) cout << endl; for (int j = 0; j < 5; j++) { num[j] = 0; } } return 0;}
1 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 统计元音
- 习近平:南海诸岛自古以来就是中国领土
- 解读企业即时通讯
- 使程序在Linux下后台运行
- spring mvc常用的注解
- “爱运动管理系统”诞生记(16)
- HDU-2027 统计元音
- 【Lintcode】斐波纳契数列
- java 的 AccessController.doPrivileged使用
- ATOM基础教程一php-cs-fixer配置(13)
- CentOS7 yum install mysql-server 没有可用包
- servlet知识总结
- LeetCode - 38. Count and Say
- (C++)UNION结构
- HDU 5532 Almost Sorted Array [DIS]