1. 程式人生 > >寫一函式,將一個字串中的母音字母複製到另一個字串,然後輸出

寫一函式,將一個字串中的母音字母複製到另一個字串,然後輸出

ae
#include<stdio.h>
#include<string.h>
void str(char a[100],char b[100])
{
int i=0, j=0;
while(a[i]!='\0')//'\0'代表ASCLL碼0的字元,即是一個空操作符也就是是結束符; 
{
if(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u')
{
b[j]=a[i];
j++;
}
i++;
} 
}
int main()
{
char a[100];
char b[100];
gets(a);
str(a,b);
puts(b);
return 0;
}