Created
November 16, 2015 06:48
-
-
Save 6uclz1/08a4defd11a56d38a53d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int count_vowel(char*); | |
int main() | |
{ | |
char *str1, *str2; | |
str1 = "now is the time"; | |
str2 = "My name is DENDAI Hanako"; | |
printf("%s,vowel:%d\n", str1, count_vowel(str1)); | |
printf("%s,vowel:%d\n", str2, count_vowel(str2)); | |
} | |
int count_vowel(char *s) | |
{ | |
int n; | |
for(n = 0; *s != '\0'; s++) | |
if(*s == 'a' || *s == 'i' || *s == 'u' || *s == 'e' || *s == 'o' || | |
*s == 'A' || *s == 'I' || *s == 'U' || *s == 'E' || *s == 'O') | |
n++; | |
return n; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment