Thread: Making functions

  1. #16
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    1. why do you need globals?
    2. scanf("%f", &amount);
    %f is for floats, %lf - is for doubles in the scanf format strings

    3. %6.2d\n", quarters
    %d is for ints, %f is for floats/doubles in the printf format strings
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  2. #17
    Registered User officedog's Avatar
    Join Date
    Oct 2008
    Posts
    77
    You might find it useful to read about the modulus operator (&#37.

    http://www.cprogramming.com/tutorial/modulus.html

    Also, it might be worth trying to describe in sentences (not code) what steps you must take to solve the problem.

    Lastly, are doubles the best type of variable to store your results?

  3. #18
    Registered User
    Join Date
    Nov 2008
    Posts
    23
    I barely even know what I'm doing...Asking me questions isn't helping me, I'm just going to reread my book and hopefully get answers. I know you guys are trying to help though, thanks for the effort.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Is it legal to have functions within functions?
    By Programmer_P in forum C++ Programming
    Replies: 13
    Last Post: 05-25-2009, 11:21 PM
  2. Attaching functions to a class/struct
    By VirtualAce in forum Tech Board
    Replies: 2
    Last Post: 08-04-2003, 10:56 AM
  3. DLL class member functions
    By nickname_changed in forum C++ Programming
    Replies: 1
    Last Post: 07-11-2003, 06:59 AM
  4. Expression Manipulator v0.2 (bug fixes, functions)
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 05-26-2003, 04:52 PM
  5. Passing data/pointers between functions #2
    By TankCDR in forum C Programming
    Replies: 1
    Last Post: 11-02-2001, 09:49 PM