I'm using visual c++ 2008. I don't know what namespace system and system::Glob.. are. I've never used "wchar_t" nor Console::Write. Is there a way to display unicode characters with the C++ that was taught to me in school? It looks that ASCII II is supported by using the char datatype while using cout.
#include<iostream>
#include <tchar.h>
using namespace System;
using namespace System::Globalization;
using namespace std;
const char z = 253;
const wchar_t y = L'\u00b2';
int main()
{
Console::Write( z );
cout << endl << z << endl;
Console::Write( y );
cout << endl << y << endl;
}
this code displays:
-3
²
²
178
Press any key to continue . . .
if i Put L'\u00b2' it gives me the same garbage.
I'm using windows 7, i don't know if it's my console, but i suspect, the teachers wouldn't be anybetter. By the way using char super2 = '253' works. I just rather have an option for the future since the ascii characters are rather limited.
if i Put L'\u00b2' it gives me the same garbage.
I'm using windows 7, i don't know if it's my console, but i suspect, the teachers wouldn't be anybetter. By the way using char super2 = '253' works. I just rather have an option for the future since the ascii characters are rather limited.
That is because your command line console is not a uni-code application which means the console window you used only can display characters in your locale page. Use wcout to output wchar_t is the right choice.