Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

OpenGL_Guru

how do you assign a char variable the DEGREES symbol?

This topic is 5265 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
Advertisement
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]

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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."

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!