一、运行结果;
二、源代码;
# define _CRT_SECURE_NO_WARNINGS
# include <stdio.h>
//声明判断元音函数;
void vowel(char a[100], char b[100]);
int main()
{
//初始化变量值;
char a[100] = { 0 };
char b[100] = { 0 };
//获取用户输入字符串;
printf("请输入一串字符串:");
scanf("%s", &a);
//输出字符串;
printf("你输入的字符串为:");
printf("%s", a);
//换行;
printf("\n");
//调用判断元音函数;
vowel(a, b);
//输出;
printf("其中的元音字母为:");
printf("%s", b);
return 0;
}
//实现判断元音函数;
void vowel(char a[100], char b[100])
{
//初始化变量值;
int i, j;
//循环判断
for (i = 0, j = 0; a[i] != '\0'; i++)
{
//判断;
if ((a[i] == 'A') || (a[i] == 'a') || (a[i] == 'O') || (a[i] == 'o') || (a[i] == 'I') || (a[i] == 'i') || (a[i] == 'E') || (a[i] == 'e') || (a[i] == 'U') || (a[i] == 'u'))
{
//复制;
b[j] = a[i];
//改变变量值;
j++;
}
//添加结束判断;
b[j] = '\0';
}
}