Thread: MPG Calculator

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    2

    MPG Calculator

    I am a beginner in C++. I have already made the part to calculate the mpg, but it only does it once. I have many reciepts i want to calcualte in one go and i want the average mpg to show when i am done, what will i have to do?

  2. #2
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    what's "the mpg"? I have no idea what you're talking about...

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    2
    mpg is miles per gallon on a car

  4. #4
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    Use a loop to keep getting input, incrementing the number of inputs inputted, and keep a tally of total miles and total gallons. Then, just divide total miles by total gallons and you're done.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. GUI Calculator - Critique
    By The Brain in forum Windows Programming
    Replies: 1
    Last Post: 02-25-2006, 04:39 AM
  2. C++ Program Help (MPG calculator)
    By mrwooter in forum C++ Programming
    Replies: 20
    Last Post: 09-28-2005, 01:46 PM
  3. Calculator + LinkedList
    By maro009 in forum C++ Programming
    Replies: 20
    Last Post: 05-17-2005, 12:56 PM
  4. Need help with calculator program
    By Kate in forum C# Programming
    Replies: 1
    Last Post: 01-16-2004, 10:48 AM
  5. Replies: 2
    Last Post: 05-10-2002, 04:16 PM