trouble丶G 发表于 2020-2-2 18:53:37

这个程序要怎么改 求助

#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 18:53:38

本帖最后由 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);
}

trouble丶G 发表于 2020-2-2 18:58:17

https://xxx.ilovefishc.com/forum/201603/08/045950mc8ivx4887fl6z7l.png

trouble丶G 发表于 2020-2-2 19:35:44

Aseeker 发表于 2020-2-2 18:53
#include

int main()


谢了
页: [1]
查看完整版本: 这个程序要怎么改 求助