wanghg


私信TA

用户名:wanghg1228

访问量:712

签 名:

等  级
排  名 16698
经  验 750
参赛次数 0
文章发表 1
年  龄 0
在职情况 学生
学  校 苏州大学
专  业

  自我简介:

解题思路:

注意事项:

参考代码:

/*****************************************************
*Copyright (C) UnionMems Co., Ltd. 2018. Allrights reserved 
* File name: copy_vowels.c
* Author: Wanghg
* Version: 1.0
* Date: 2018/11/15
* Description: Copy the vowels in a string to another string.
*****************************************************/
#include<stdio.h>
#define ORIGIN_SIZE 100
#define VOWEL_SIZE 50
void copy_vowels(char*,char*);    /*function declaration*/
int main(void)
{
    char oringin_str[ORIGIN_SIZE] = {0};    /*initialize the string array*/
    char vowels_str[VOWEL_SIZE] = {0};
    gets(oringin_str);  /*Enter the original string*/
    copy_vowels(oringin_str,vowels_str);   /*calling the copy_vowels function*/
    puts(vowels_str);   /*Output all elements of the vowel string */
    return 0;
}

/*****************************************************
* Function: copy_vowels
* Description: Copy the vowels in a string to another string
* Input(s): *oringin_str,*vowels_str
* output(s): NO
* Return: NO
* Author: wanghg
* History: NO
*****************************************************/
void copy_vowels(char *oringin_str,char *vowels_str)
{
    int length = 0;
    while(*oringin_str != '\0')
    {
        if((*oringin_str == 'a') || (*oringin_str == 'e') || (*oringin_str == 'o') ||
           (*oringin_str == 'i') || (*oringin_str == 'u'))   /*Is it vowel?*/
        {
            vowels_str[length] = *oringin_str;  /*Put vowels  into the string vowels_str*/
            length++;             
        }
        oringin_str++;
    }
    vowels_str[length + 1] = '\0';
}

 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区