HDU 2027 统计元音

本文提供了一段用于解决特定编程问题的代码实现,详细解释了如何通过输入字符计数来统计元音字母的数量,并在每组输入后换行显示结果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2027

只是为了刷水题,没啥好说的,直接水过。

代码:

#include<stdio.h> #include<string.h> int main() { char str[101]; int s,i,j,len,count1,count2,count3,count4,count5; scanf("%d",&s); getchar(); for(j=0;j<=s-1;j++) { gets(str); len=strlen(str); count1=count2=count3=count4=count5=0; for(i=0;i<=len-1;i++) { if(str[i]=='a') count1++; if(str[i]=='e') count2++; if(str[i]=='i') count3++; if(str[i]=='o') count4++; if(str[i]=='u') count5++; } printf("a:%d\n",count1); printf("e:%d\n",count2); printf("i:%d\n",count3); printf("o:%d\n",count4); printf("u:%d\n",count5); if(j<s-1) { printf("\n"); } } return 0; }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值