Use accents in a wcin

  accent-sensitive, c++

I’m a beginner in c++ and I want to use accents in wstring and remove the accents. I can put accents in wstrings from the program but not with wcin which replaces them with a code of form 2. I tried to store these codes in a string too or an array but it doesn’t work either. Is there a way to enter the accents without using this code or to store the codes in a string ?

Here is my code

wstring removeAccent(wstring  aWord) {
    wstring dictionnaryAccent =L"ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÌÍÎÏìíîïÙÚÛÜùúûüÿÑñÇç";
    string dictionnaryNoAccent ="AAAAAAaaaaaaOOOOOOooooooEEEEeeeeIIIIiiiiUUUUuuuuyNnCc";
    for (int i = 0;i<=aWord.length();i++)
    {
        for (int j =0 ; j< dictionnaryAccent.length();j++)
        {
            if (aWord[i]==dictionnaryAccent[j])
            {
                aWord[i]=dictionnaryNoAccent[j];
            }
        }
    }
    return aWord; }

Here is how aWord looks :debug

Source: Windows Questions C++

LEAVE A COMMENT