|
5鱼币
#include <stdio.h>
int main()
{
int ch;
int count1 = 0, count2 = 0, count3 = 0, count4 = 0, count5 = 0, count = 0;
printf("请输入一个英文句子:");
while((ch = getchar()) != '\n')
{
if(ch = '97')
count1 = count1 + 1;
if(ch = '101')
count2 = count2 + 1;
if(ch = '105')
count3 = count3 + 1;
if(ch = '111')
count4 = count4 + 1;
if(ch = '117')
count5 = count5 + 1;
if(ch = '97','101','105','111','117')
count = count + 1;
}
printf("您输入的句子中 , 包含元音字母%d个!",count);
printf("a (%d),e (%d),i (%d),o (%d),u (%d) \n",count1,count2,count3,count4,count5);
}
本帖最后由 Aseeker 于 2020-2-2 19:21 编辑
#include <stdio.h>
int main()
{
int ch;
int count1 = 0, count2 = 0, count3 = 0, count4 = 0, count5 = 0, count = 0;
printf("请输入一个英文句子:");
while((ch = getchar()) != '\n')
{
if(ch == 'a'|| ch == 'A')
count1 = count1 + 1;
if(ch == 'e'|| ch =='E')
count2 = count2 + 1;
if(ch == 'i'|| ch == 'I')
count3 = count3 + 1;
if(ch == 'o'|| ch == 'O')
count4 = count4 + 1;
if(ch == 'u'||ch == 'U')
count5 = count5 + 1;
}
count = count1 + count2 + count3 + count4 + count5 ;
printf("您输入的句子中 , 包含元音字母%d个!",count);
printf("a (%d),e (%d),i (%d),o (%d),u (%d) \n",count1,count2,count3,count4,count5);
}
|
最佳答案
查看完整内容
#include
int main()
{
int ch;
int count1 = 0, count2 = 0, count3 = 0, count4 = 0, count5 = 0, count = 0;
printf("请输入一个英文句子:");
while((ch = getchar()) != '\n')
{
if(ch == 'a'|| ch == 'A')
count1 = count1 + 1;
if(ch == 'e'|| ch =='E')
count2 = count2 + 1;
...
|