power function

This is a discussion on power function within the C Programming forums, part of the General Programming Boards category; how to make the 3 in dm3 to superscript? [What is the volume(in dm3) ]...

  1. #1
    yjn
    yjn is offline
    Registered User
    Join Date
    Mar 2012
    Posts
    20

    power function

    how to make the 3 in dm3 to superscript?

    [What is the volume(in dm3) ]

  2. #2
    Registered User
    Join Date
    Dec 2011
    Posts
    795
    Think about what dm3 really means. It evaluates to (dm*dm*dm). If you know that the 3 will be constant, you could hard-code the multiplication for a much faster result.

    Alternately, look into the built-in math functions, especially pow() > cmath (math.h) - C++ Reference

  3. #3
    yjn
    yjn is offline
    Registered User
    Join Date
    Mar 2012
    Posts
    20
    i want to display the dm3 using printf
    printf("2. What is the volume(in dm3)of 1 mol of any gas at any room conditions?")
    how to produce an output with dm(superscript 3)

  4. #4
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    1,616
    What you want to do is system-specific, unless you use Unicode. ASCII characters don't include superscript numbers( neither index ones ).
    Devoted my life to programming...

  5. #5
    yjn
    yjn is offline
    Registered User
    Join Date
    Mar 2012
    Posts
    20
    can u give me a source code regarding to this problem?

  6. #6
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    1,616
    Nope, but I can give you a link to wikipedia.
    Devoted my life to programming...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Power Function through Recursive
    By neo_2010 in forum C++ Programming
    Replies: 1
    Last Post: 10-28-2009, 08:45 PM
  2. Th power function
    By wiz23 in forum C++ Programming
    Replies: 6
    Last Post: 04-12-2005, 05:56 AM
  3. Recursive Power function
    By MethodMan in forum C Programming
    Replies: 12
    Last Post: 12-08-2002, 01:13 PM
  4. Power function question...
    By DramaKing in forum C Programming
    Replies: 6
    Last Post: 02-11-2002, 03:59 PM
  5. power function
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 11-06-2001, 12:11 AM

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