2021年3月28日星期日

Finding whether an input contains a vowel

The sample input contains: 3, omahgoToRuLob, OmAhgotUrulobEI, aYfun The expected output is: ugly string pretty string pretty string

I received an error such as: 22:7: error: array size missing in 'string' 27:23: error: expected expression before ']' token 29:14: error: expected expression before ']' token

My code is in c programming.

#include <math.h>  #include <string.h>  #include <stdlib.h>  #include <stdio.h>    int main(){      int i;      char string[100];      char vowels = {"a", "e", "i", "o", "u", "A", "E", "I", "O", "U"};        for (i = 1; i < 4; ++i)      {          scanf("%99s", string[]);            if (string[] == vowels)               printf("lovely string \n");          else              printf("ugly string \n");        }        return 0;  }  
https://stackoverflow.com/questions/66848057/finding-whether-an-input-contains-a-vowel March 29, 2021 at 10:25AM

没有评论:

发表评论