C language - vowels find

Title Description
write a function to copy the two vowels string to another string, and then output.

Input
line string
output
sequentially output wherein vowels (aeiuo)
Sample Input
abcde
Sample Output
ae

# include<stdio.h>
# include<string.h>
int main()
{
	char ch1[1000],ch2[1000];
	int m,n,i,j,k;
	gets(ch1);m=strlen(ch1);
	for(i=0,j=0;i<m;i++)
	{
		if(ch1[i]=='a'||ch1[i]=='e'||ch1[i]=='i'||ch1[i]=='o'||ch1[i]=='u')
		{
			ch2[j]=ch1[i];
			j++;
		}
	}
	puts(ch2);
	return 0;
}

Note: This can also be determined directly subject string functions.

Published 123 original articles · won praise 8 · views 20000 +

Guess you like

Origin blog.csdn.net/Du798566/article/details/104887413