3

I found bunch of code examples but these are for MSVC++, these examples fail under MinGW so I wonder if it is possible at all in MinGW ? Maybe this is feature available only in MSVC ?

If it is possible, can you please provide me with simple self sustainable code that would print a Hello World message but in for example russian (привет мир).

rsk82
  • 28,217
  • 50
  • 150
  • 240

1 Answers1

0

You can assign it to a character array and then print it. The only thing you have to be careful is that you have to save it as a UNICODE file and to use a compiler that can read UNICODE files.

#include<iostream.h>

int main()
 {
 using namespace std;
 wchar_t a[]={'п','р','и','в','е','т',' ','м','и','р'};
 for(int x=1; a[x]!='\0'; x++)
      wcout<<a[x];
 return 0;
 }

This will print the output as follows.

привет мир

OR, if you want just ASCII characters, you can print them by specifying it's character code.

#include<iostream.h>

int main()
 {
 for(int x=1; x<40; x++)
      cout<<char(x)<<"\t";
 return 0;
 }

This will print the ASCII characters corresponding to the number as shown below.

☺        ☻        ♥        ♦        ♣        ♠
        ♫        ☼        ►        ◄        ↕        ‼        ¶        §
▬        ↨        ↑        ↓
Praveen Vinny
  • 2,372
  • 6
  • 32
  • 40