0

How do I print Unicode in C++?

I am trying to print a square root symbol for a program that i am making that will solve the quadratic formula and more but i need to find a way to print unicode. Does c++ even allow unicode? And so far the only thing i have found for unicode is a library but i have to download it and i am not sure if the library will even download onto SoloLearn. I have already tried many things and one thing was close to working since it was printing the unicode but the unicode code for each character was different so when i typed in the unicode for a square root it gave me Ü. so i think that it maybe able to print unicode just the code for each unicode is different. I for got the program i used to give me the Ü but i did use wchar_t to place it in. pls help i am in trouble

14th Dec 2016, 2:49 AM
Emmanuel Gonzalez
Emmanuel Gonzalez - avatar
1 Answer
0
When matters like this arises, you should post a bit of your source code where you get the error. I cant really help but if i may guess from your source code, i will give this answer as an example. wchar_t sqRoot = {0}; sprintf(sqRoot, L"%S", resultVal); alternative:- TCHAR sqRoot = {0}; sprintf(sqRoot, TEXT("%S"), resultVal); NB: sqRoot should be d variable to store your unicode value. resultVal should be a variable assiged to your quadratic answer. what those lines of code does is to print out Unicode. if %S doesnt work for you, %s should work ( capital S or small letter s )...
14th Dec 2016, 6:12 AM
Franky BrainBox
Franky BrainBox - avatar