1 solutions

  • 0
    @ 2025-11-5 19:24:17

    C :

    #include<stdio.h>
    #include<string.h>
    int main()
    {
        char a[300];
        int i=-1;
        gets(a);
        while(a[++i]!='\0')
        {
            if(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u')
                putchar(a[i]);
        }
        puts("");
        return 0;
    }
    
    

    C++ :

    #include<iostream>
    #include<string.h>
    using namespace std;
    int main()
    {
        char a[50],b[50],c,d=0;
        cin>>a;
        c=strlen(a);
        while(c--)
            if(a[c]=='a'||a[c]=='e'||a[c]=='i'||a[c]=='o'||a[c]=='u')
                b[d]=a[c],d++;
        while(d--)
            cout<<b[d];
    }
    
    

    Pascal :

    var st:string;
        i:longint;
    begin
      readln(st);
      for i:=1 to length(st) do
      if (st[i]='a') or (st[i]='e') or  (st[i]='i') or (st[i]='o') or  (st[i]='u') then write(st[i]);
    end.
    
    • 1

    C语言程序设计教程(第三版)课后习题8.7

    Information

    ID
    19343
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By