For fun i coded a simple code in cpp using the Cesar's wheel to encrypt messages but i can't display accents and non ASCII characters while i used some wstring, wcin and wcout I also used the library locale to use the system encoding in the terminal opened by VScode and it works but not in the code i want. My VScode is pre-configured by my school for cpp coding and it opens a Windows Terminal window to run the code.
Here is the code that display accent and non ASCII characters :
#include <iostream>
#include <locale>
using namespace std;
int main() {
setlocale(LC_ALL, "");
wcout << L"Texte avec accents : é, à, ô" << endl;
return 0;
}
In the actual code i want it to works it doesn't so i need help. Here is the code i want to kdisplay non ASCII characters and it doesn't :
#include <iostream>
#include "game-tools.h"
#include <locale>
using namespace std;
wstring messageACrypter;
void demanderMessage(wstring &message);
void encrypterLeMessage(wstring& message);
int main()
{
setlocale(LC_ALL, "");
demanderMessage(messageACrypter);
encrypterLeMessage(messageACrypter);
return 0;
}
void demanderMessage(wstring &message)
{
wcout << "Quel est le message que vous voulez encrypter via le systeme de la roue de Cesar" <<endl;
wcin >> message;
}
void encrypterLeMessage(wstring &message)
{
setlocale(LC_ALL, "");
int memTemp;
wstring memTempString;
wstring messageCode;
int nbrDeCryptage;
nbrDeCryptage = random(1,26);
for (int i = 0; message[i] != '\0'; i++)
{
memTemp = int(message[i])+nbrDeCryptage;
memTempString=wchar_t(memTemp);
messageCode+= memTempString;
}
wcout<<"Voici le message encrypte"<<endl;
wcout<<messageCode;
}
If you have any suggestions i'll take them and sorry i'm not that good in coding i'm in my first year in IT college