1 条题解

  • 0
    @ 2025-4-7 21:19:29

    C :

    #include <stdio.h>
    
    int main()
    {
    	char a[100];
    	char b;
    	int i,j;
    	for (i=1;;i++)
    	{
    		b = getchar ();
    		if (b!='\n')
    		{
    		   a[i] = b;
    		}
    		else
    		{break;}
    	}
    	for (j=1;j<i;j++)
    	{
    		if (a[j]=='a' ||a[j]=='e' ||a[j]=='i' ||a[j]=='o' ||a[j]=='u')
    		{printf("%c",a[j]);}
    	}
    	printf ("\n");
    	return 0;
    }
    

    C++ :

    #include<stdio.h>
    int main()
    {
    	void cpy(char[], char[]);
    	char str[80], c[80];
    	gets(str);
    	cpy(str, c);
    	printf("%s\n", c);
    	return 0;
    }
    
    void cpy(char s[], char c[])
    {
    	int i, j;
    	for (i = 0, j = 0; s[i] != '\0'; i++)
    		switch (s[i])
    	{
    		case 'A':c[j] = s[i], j++; break;
    		case 'a':c[j] = s[i], j++; break;
    		case 'E':c[j] = s[i], j++; break;
    		case 'e':c[j] = s[i], j++; break;
    		case 'I':c[j] = s[i], j++; break;
    		case 'i':c[j] = s[i], j++; break;
    		case 'O':c[j] = s[i], j++; break;
    		case 'o':c[j] = s[i], j++; break;
    		case 'U':c[j] = s[i], j++; break;
    		case 'u':c[j] = s[i], j++; break;
    	}
    	c[j] = '\0';
    }
    
    

    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

    信息

    ID
    1212
    时间
    1000ms
    内存
    12MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者