1094: 统计元音(函数专题)

来源:互联网 发布:arduino matlab编程 编辑:程序博客网 时间:2024/06/05 02:09

1094: 统计元音(函数专题)

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 5567  Solved: 3730

SubmitStatusWeb Board

Description

 输入一个字符串,统计其中元音字母的个数。要求使用函数vowel()用来判断是否为元音,其余功能在main()函数中实现。 
int vowel(char ch) 

//如果ch是元音,返回1,否则返回0 
}

Input

 输入一个字符串,长度不超过1000,以回车符结束。

Output

 输出一个整数,表示元音字母个数。输出单独占一行。

Sample Input

Hello world!

Sample Output

3

HINT

Source

*




#include<stdio.h>#include<string.h>int yuanyin(char ch);int yuanyin(char ch){    if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'||ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U')        return 1;    else        return 0;}int main(){    char ch;    int b,i;    i=0;    b=0;    while(scanf("%c",&ch),ch!='\n')    {        b=yuanyin(ch);        if(b==1)            i=i+1;        else            i=i+0;    }    printf("%d\n",i);    return 0;}