+ 2

Unicode

Alright. I was going through some of the code playground bits that were already out there and found @NezhnyjVampir's Alphabet array and found it interesting. I thought that for my code I would up the ante a little bit and try to get it to use the Greek alphabet. I've been all over the internet and can't figure out how to get this to work. I can't get it to display Unicode characters properly and I keep getting dumb errors like my code is trying to convert from wchar_10 or it doesn't support << for outputs. Here's the code I have already... I'm using the latest version of VS C++: // ConsoleApplication1.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> using namespace std; #include <string> int main() { locale::global(locale("en_US.utf8")); wcout.imbue(locale()); wstring gAlphabet[] = { L"No letter", L"\u0319"}; int num; cin >> num; if (num == 0 || num > 1) { cout << gAlphabet[0]; } else { cout << "The letter number " << num << " of the Greek alphabet is " << gAlphabet[num] << endl; } return 0; } Also, VS keeps forcing me to use that stdafx.h file, which is throwing me. I tell it not to do a precompiled header for my project and yet it forces me to include stdafx.h.

19th Aug 2017, 4:35 PM
Yuri
2 odpowiedzi
+ 1
For the standard header: Make an empty project and then just add the Main.cpp file by hand.
20th Aug 2017, 8:24 AM
StoneSmasher
StoneSmasher - avatar
+ 1
Thank you for the info, @StoneSmasher. :)
20th Aug 2017, 2:20 PM
Yuri