Jump to content

transformar letras com acento como "ç" em "c"


HUGO

Recommended Posts

#include <stdio.h>
#include <stdlib.h>

#include <string.h>
#include <strings.h>
#include <ctype.h>


char recebendo_String(char *s){
    int x = 0;
    int y = 0;
    char caracter ;
    char caracter_nao_acentuado[]="aaaaeeeeiiiioooouuuucAAAAEEEEIIIIOOOOUUUUC";
    char caracter_acentuado[]="áàãâéèẽêíìĩîóòõôúùũûçÁÀÃÂÉÈẼÊÍÌĨÎÓÒÕÔÚÙŨÛÇ";
    caracter = toupper(fgetc(stdin));
    for(x = 0 ; x < (100 - 1) ; x++){
        
        if(((caracter == '\n') && (x == 0)) || ((caracter ==' ') && (x ==0))){
            x = x -1;  
            continue;
        }
        if(caracter == '\n'){
            break;
        }
        for(y = 0 ; y < 43 ; y++){
            if(caracter_acentuado[y] == caracter)
                caracter = caracter_nao_acentuado[y];
        
            
        }
        s[x] = caracter;
    }
    s[x] = 0;
    return (caracter);
}





int main()
{
    char escreva;
    printf("Hello world!\n");
    printf("digite um caracter :");
    recebendo_String(&escreva);
    
    return 0;
}

Esse codigo deveria retornar ao refente sem acento mas da o erro :

*** stack smashing detected ***: <unknown> terminated
Abortado (imagem do núcleo gravada)

 
Link to comment
Share on other sites

  • 5 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.