Thread: Please help a beginner with float...

  1. #1
    Registered User
    Join Date
    Sep 2008
    Posts
    22

    Please help a beginner with float...

    *question answered*
    Last edited by BobDole11; 09-14-2008 at 11:07 AM. Reason: tabstop helped me

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    %d says "the thing being passed in is an integer" while %f says "the thing being passed in is a float (actually, a double)". So just change %d to %f when you have a decimal point thing.

  3. #3
    Registered User
    Join Date
    Sep 2008
    Posts
    22
    Okay, so i changed the %d's to %f's in the instances where I use 3.14159, but how would i do it so you can input a whole number integer or a decimal?

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Same deal -- but of course be sure you store it in "float radius" and not "int radius". (A float can handle 3 just as well as it can handle 8.76.)

  5. #5
    Registered User
    Join Date
    Sep 2008
    Posts
    22
    Alright, thanks man

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 05-13-2009, 03:25 PM
  2. Replies: 14
    Last Post: 06-28-2006, 01:58 AM
  3. Could somebody please help me with this C program
    By brett73 in forum C Programming
    Replies: 6
    Last Post: 11-25-2004, 02:19 AM
  4. Half-life SDK, where are the constants?
    By bennyandthejets in forum Game Programming
    Replies: 29
    Last Post: 08-25-2003, 11:58 AM
  5. How do you search & sort an array?
    By sketchit in forum C Programming
    Replies: 30
    Last Post: 11-03-2001, 05:26 PM