C语言编写函数,将一个字符串中元音字母复制到另一个字符串
#include #include int main(){void fun(char str1[20]);char str[20];printf("请输入一串字符串:");gets(str);fun(str);return 0;}void fun(char str1[20]){int i, j, k;char str2[20];for (i = 0, j = 0; i < (k = str1[i]) != '\0'; i++){if ((k == 'A' || k == 'E' || k == 'I' || k == 'O' || k == 'U') || (k == 'a' || k == 'e' || k == 'i' || k == 'o' || k == 'u')){str2[j] = k;j++;}}str2[j] = '\0';printf("\n原字符串中含有的元音字符为:%s\n", str2);}