1
I’m trying to use the accent in c++ but in the output the text continues without formatting I’m using the visual studio code.
#include <iostream>
#include <locale.h>
int main ()
{
setlocale(LC_ALL, "portuguese");
int NumVidas = 5;
int Pontuacao = 1350;
std::cout << "Inicio de jogo\n" << std::endl;
std::cout << "Numero de vidas: "<< NumVidas << std::endl;
std::cout << "Pontuação: " << Pontuacao << "\n";
NumVidas -= 1;
Pontuacao -= 350;
std::cout << "\nNumero de vidas: "<< NumVidas << std::endl;
std::cout << "Pontuação: " << Pontuacao << "\n";
system("PAUSE");
}
Use "en" as locale. Test the return of
setlocale()
to see if the locale has been accepted. Runlocale -a
on your machine to see the list of locales if you are using Linux or even Windows if you have for example git installed.– arfneto