• C语言:写一函数,将两个字符串中的元音字母复制到另一个字符串,然后输出


    题目描述

    写一函数,将两个字符串中的元音字母复制到另一个字符串,然后输出。

    输入

    一行字符串

    输出

    顺序输出其中的元音字母(aeiuo)

    样例输入

    abcde

    样例输出

    ae

    编码:
    #include<stdio.h>
    #include<stdlib.h>
    #include<string.h>  
      
    char str1[100];  
    char str2[100];  
    char str[6] = {'a' , 'e' , 'i' , 'o' , 'u'};  
    int main()  
    {  
        while(gets(str1) != NULL)  
        {  
            int i = 0;  
            int k = 0,j;  
            int len = strlen(str1);  
            while(i < len)  
            {  
                for( j = 0 ;j < 5;j++)  
                    if(str1[i] == str[j])  
                    {  
                        str2[k++] = str1[i];  
                        break;  
                    }  
                i++;  
            }  
            puts(str2);  
        }  
        return 0;  
    }  
    
    
    

      

     
  • 相关阅读:
    Python Day14
    Python Day13
    Python Day12
    Python Day11
    Python Day10
    Python Day9
    Python Day8
    Python Day7
    Python Day6
    Python Day5
  • 原文地址:https://www.cnblogs.com/songqingbo/p/8934316.html
Copyright © 2020-2023  润新知