Thread: Using the degree sign

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    102

    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<<

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    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
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Feb 2009
    Posts
    42
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sign ' is the same as \' ?
    By George2 in forum C Programming
    Replies: 1
    Last Post: 11-23-2007, 07:32 AM
  2. Computing Degree Question
    By cjwenigma in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 09-17-2007, 01:06 PM
  3. My own itoa()
    By maxorator in forum C++ Programming
    Replies: 18
    Last Post: 10-15-2006, 11:49 AM
  4. Entering in an nth degree polynomial
    By Noah in forum C Programming
    Replies: 1
    Last Post: 03-02-2006, 09:02 PM
  5. Handle on MSN Messenger's Sign In "button"?
    By jmd15 in forum Windows Programming
    Replies: 3
    Last Post: 07-16-2005, 09:28 PM