Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Crie um programa com uma função que recebe uma string A de tamanho
- máximo 50, fornecida pelo usuário. A função deve, então, remover todas as
- vogais (substituindo-as por espaços em branco) e retornar esta nova string
- para a função main. Por fim, deve-se imprimir em uma linha a string A sem
- vogais e na linha seguinte a string A com vogais.
- */
- #include <stdio.h>
- #include <string.h>
- #define tam 50
- int removeVogal(char A[tam])
- {
- int i, tamanho = strlen(A);
- for(i=0; i<tamanho; i++)
- {
- if(A[i]=='a' || A[i]=='A')
- {
- A[i]= ' ';
- }
- if(A[i]=='e' || A[i]=='E')
- {
- A[i]= ' ';
- }
- if(A[i]=='i'|| A[i]=='I')
- {
- A[i]= ' ';
- }
- if(A[i]=='o' || A[i]=='O')
- {
- A[i]= ' ';
- }
- if(A[i]=='u' || A[i]=='U')
- {
- A[i]= ' ';
- }
- }
- }
- int main(){
- char frase[tam], aux[tam];
- puts("digite uma frase de ate 50 caracters: \n");
- scanf("%[^\n]s",&frase);
- getchar();
- for(int i=0;i<strlen(frase);i++){
- aux[i]=frase[i];
- }
- removeVogal(frase);
- printf("\n%s\n%s", frase, aux);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement