Making functions

This is a discussion on Making functions within the C Programming forums, part of the General Programming Boards category; 1. why do you need globals? 2. scanf("%f", &amount); %f is for floats, %lf - is for doubles in the ...

  1. #16
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    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
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  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.

Page 2 of 2 FirstFirst 12
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, 08:49 PM

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