-
Using the degree sign
I am trying to write a small programme that converts from Celsius to Fahrenheit. I want to use the degree programme and I don't know how I can get it displayed. Any help is appreciated.
PS: I mean how do you get it to display. So, for example you have cout << and you want to display it<<
-
It may not work for you, but I get a degree sign by holding down ALT and typing 248 on the numeric keypad (if numlock is enabled). Like this: °
However, it does depend on the font and the "code-page" (which translates the "ASCII" codes to glyphs).
--
Mats
-
If you mean how can you print the symbol, I do it like this:
cout << static_cast<char>(248) << endl;
Check a ASCII table for the value of the symbol you want to print, and then use static_cast<char>(number of symbol you want to print) to do it.
Note that this is the only way I know how to do it, so there might be a better alternative.