how do you assign a char variable the DEGREES symbol?
i want to print out the degrees symbol in C++, in the extended ASCII table the degrees symbol is 0x178, however this doesnt work when i just assign it and try to print it out. anyone know how i can achieve this? thanks!
nevermind i figured it out.. ill give you the command but i dont see this as a match in the ASCII table??
cout << (char) 176
if you do this, it will print out the Degrees Symbol.. i am guessing (char) converts this to Unicode instead of ASCII? anyone know? thanks..when you are in WORD or OFfice or something its easy to convert..but in C++ it may depend on compiler? wondering how C++ looks up the different tables and where they are stored.
[edited by - opengl_guru on January 22, 2004 1:48:02 PM]
cout << (char) 176
if you do this, it will print out the Degrees Symbol.. i am guessing (char) converts this to Unicode instead of ASCII? anyone know? thanks..when you are in WORD or OFfice or something its easy to convert..but in C++ it may depend on compiler? wondering how C++ looks up the different tables and where they are stored.
[edited by - opengl_guru on January 22, 2004 1:48:02 PM]
quote:Original post by OpenGL_Guru
nevermind i found it.. ill give you the command but i dont see this as a match in the ASCII table??
if you do a cout << (char) 176, it will print out the Degrees Symbol.. i am guessing (char) converts this to Unicode instead of ASCII? anyone know? thanks..
No, it''s a question of codepage. Depending on which one is active, you will get different characters in the "extended ASCII" range. And, as it happens, Windows uses different codepages in its console and GUI windows... (at least, as far as I can tell).
“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” — Brian W. Kernighan (C programming language co-inventor)
except i dont have that symbol on my keyboard lol. i guess you can copy and paste from WOrd but havent tried to see if this will work. besides i will be printing this out using GLUT or maybe something different in openGL so i have to this about that issue too. lets say you have an environment and you want to be able to display the degrees F outside you might say at one particular frame 67.78°F or something.
I don''t either, but I do have Windows, which comes with cool little utility called "Character Map" (start->Programs->Accessories->System Tools). Copy->paste from there, no MS Word needed
I''m guessing the cause of you first failure was using char instead of unsigned char.
-----------
VenDrake
"My stupid jar is full. I can''t talk to you anymore."
-----------
VenDrake
"My stupid jar is full. I can''t talk to you anymore."
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement