Insert Math Symbols

This is a discussion on Insert Math Symbols within the C Programming forums, part of the General Programming Boards category; Dear C Programming Community, How would I insert a math symbol along with a numerical result in a printf statement? ...

  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    1

    Insert Math Symbols

    Dear C Programming Community,

    How would I insert a math symbol along with a numerical result in a printf statement?

    Thank you,

    MarkTheSpark

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    What have you tried? Is the symbol in a specific character set?
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    Insert it as a character/string

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    181
    Code:
    printf("%d + %d",1,2);
    s.s.harish
    Last edited by ssharish; 06-09-2005 at 06:53 AM.

  5. #5
    Jez
    Jez is offline
    The C-er
    Join Date
    Mar 2004
    Posts
    192
    printf("%d + %d",1.2);
    should be printf("%d + %d",1,2);

    or even printf ("0"); - a mathematical symbol and a numerical result all rolled into one.

  6. #6
    Registered User
    Join Date
    Jan 2005
    Posts
    181
    thax Jez my typing mistake

    s.s.harish

  7. #7
    Registered User
    Join Date
    Jun 2005
    Posts
    4
    check out the ascii values of the math symbols then you can use printf to print that symbols

  8. #8
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    You should also just be able to use constants.

    Code:
    char plus = '+';
    char minus = '-';

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 02-02-2009, 07:27 AM
  2. Trouble with Windows/DirectX programming
    By bobbelPoP in forum Windows Programming
    Replies: 16
    Last Post: 07-08-2008, 03:27 AM
  3. Strange error?
    By MrLucky in forum C++ Programming
    Replies: 5
    Last Post: 02-04-2006, 03:01 PM
  4. how to use operator+() in this code?
    By barlas in forum C++ Programming
    Replies: 10
    Last Post: 07-09-2005, 08:22 PM
  5. reading math symbols
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 08-08-2003, 11:13 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21