Galera helps me: the exercise I'm trying to do is 4. Write a program where:
a) Read a character that must be one of the alphabet vowels, which may be uppercase or lowercase.
b) If a function is found in which you check which vowel has been read, print one of the following messages, depending on the case:
1st vowel,
2nd vowel,
3rd vowel,
4th vowel,
5th vowel or
Another character
Can anyone tell me what I'm doing wrong?
#include<stdlib.h>
#include<locale.h>
char VogaLida (char Vogal [], int TamanhoVetor);
int main (){
setlocale(LC_ALL, "PORTUGUESE");
char Vogal [] = {'a', 'e', 'i', 'o', 'u'};
char VogalLida;
printf("Informe uma vogal: ");
gets(Vogal);
VogalLida = VogaLida(Vogal, 5);
}
char VogaLida (char Vogal [], int TamanhoVetor)
{
int i = 0;
for (i = 0; i < 5; i++){
if (i == Vogal[0]) {
Vogal[0] = 'a' | 'A';
printf("1ª Vogal\n");
return 0;
}
else if (i == Vogal[1]){
Vogal[1] = 'e' | 'E';
printf("2ª Vogal\n");
return 0;
}
else if (i == Vogal[2]){
Vogal[2] = 'i' | 'I';
printf("3ª Vogal\n");
return 0;
}
else if (i == Vogal[3]){
Vogal[3] = 'o' | 'O';
printf("4ª Vogal\n");
return 0;
}
}
return 0;
}