-2
#include<stdio.h>
#include<conio.h>

main()
{
char texto[41];
int n,i;

printf("Entre com um texto\n");  gets(texto);
for(n=0;texto[n]!='\0';n++);

i=0;
while(texto[i]!='\0')
{
   if (texto[i]== 'A' || texto[i]== 'a' || texto[i]== 'E' || texto[i]=='e' || texto[i]== 'I' || texto[i]== 'i' || texto[i]== 'O' || texto[i]== 'o' || texto[i]== 'U' || texto[i]== 'u')
      texto[i]==' ';
        }
i=i+1;


puts (texto);
}

Acabei de começar a ver C e não estou conseguindo resolver esse exercício.

1

1 Resposta 1

0

Uma maneira de resolver o problema é utilizando um segundo vetor para armazenar o texto novo.

#include<stdio.h>
#include<conio.h>

main()
{
    char texto[41], texto2[41];
    int n,i,vogais=0,j=0;

    printf("Entre com um texto\n");  
    gets(texto);
    i=0;
    while(texto[i]!='\0')
    {
        if (!(texto[i]== 'A' || texto[i]== 'a' || texto[i]== 'E' || texto[i]=='e' || texto[i]== 'I' || texto[i]== 'i' || texto[i]== 'O' || texto[i]== 'o' || texto[i]== 'U' || texto[i]== 'u')){
            texto2[j]=texto[i];
            j++;
        }
    i++;
    }
    texto2[i]=0;

puts (texto2);

return 0;
}

Você deve fazer log-in para responder a esta pergunta.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .