Thread: Need help please :) Newbie trying to learn

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    494
    use some comments to keep track of your code.
    create an avg function and then you can just call it.

    and you are using avg without it being initalized.
    When no one helps you out. Call google();

  2. #2
    Registered User
    Join Date
    Feb 2006
    Posts
    43
    so...ummm....there was absolultly no problem with the for loop...it just had to be done differently in order to change the number each time.
    Code:
    printf ("\nEnter the number of gallons used for tank #%d: ",gallused);
    And then the very last statement of the for loop should be something along these lines
    Code:
    avg = avg+gallons_used;
    or
    Code:
    avg += gallons_used;
    which is actually the same thing but thats another lesson.

    Then, just before you print the overall average, you need to divide the avg by three.
    Also, don't forget that you need to initiate avg as 0.0 at the beginning of the program.

  3. #3
    Registered User
    Join Date
    Feb 2006
    Posts
    33
    Thank you crazedbrit I finally got it to work I appreciate everyones help

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Do you ever try to learn too much?
    By Stonehambey in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 06-17-2008, 07:55 AM
  2. Can you actually learn c++ in 21 days?
    By Raeliean in forum C++ Programming
    Replies: 14
    Last Post: 07-27-2005, 03:41 PM
  3. You have to learn C in order to learn C++
    By gandalf_bar in forum A Brief History of Cprogramming.com
    Replies: 20
    Last Post: 07-16-2004, 10:33 AM
  4. Novice trying to learn C++
    By dead in forum C++ Programming
    Replies: 10
    Last Post: 12-01-2003, 09:25 PM
  5. Trying to learn guitar
    By Ben_Robotics in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 07-10-2003, 03:15 AM