Returning

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jan 2008
Posts: 124
Reputation: Jboy05 is an unknown quantity at this point 
Solved Threads: 1
Jboy05 Jboy05 is offline Offline
Junior Poster

Re: Returning

 
0
  #11
Feb 28th, 2008
double MPG ( double sizeoftank, double number of milest, double gasleftintank)
{
double numberofmilest;

numberofmilest=sizeoftank/gasleftintank;
return numberofmilest;
}

Done
I have not run the function in a program, its the freaking math of this thats pissing me off, this shit is frustrating
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 66
Reputation: superjacent is an unknown quantity at this point 
Solved Threads: 3
superjacent's Avatar
superjacent superjacent is offline Offline
Junior Poster in Training

Re: Returning

 
0
  #12
Feb 28th, 2008
Originally Posted by Jboy05 View Post
double MPG ( double sizeoftank, double number of milest, double gasleftintank)
{
double numberofmilest;

numberofmilest=sizeoftank/gasleftintank;
return numberofmilest;
}

Done
I have not run the function in a program, its the freaking math of this thats pissing me off, this shit is frustrating
miles / gallons = mpg
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 124
Reputation: Jboy05 is an unknown quantity at this point 
Solved Threads: 1
Jboy05 Jboy05 is offline Offline
Junior Poster

Re: Returning

 
0
  #13
Feb 28th, 2008
double MPG ( double sizeoftank, double number of milest, double gasleftintank)
{
double numberofmilest;

sizeoftank=numberofmilest/gasleftintank;
return sizeoftank;

}

i switched the bolded statement around if miles/gallon will yeild mpg then I guess this is right...let me rephrase that I hope this is right....
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 66
Reputation: superjacent is an unknown quantity at this point 
Solved Threads: 3
superjacent's Avatar
superjacent superjacent is offline Offline
Junior Poster in Training

Re: Returning

 
0
  #14
Feb 28th, 2008
Ok, I can see where you are confused and I apologise accordingly. I re-read your initial first post and I skipped the bits about the information to be input being 1. size of tank, 2. gallons left and 3. miles travelled. I assumed (lesson never assume) that gallons used was inputted directly. In that regard, yes, there are three (not two as I previously mentioned) arguments to be passed into the function. In the function simply deduct gallons left from size of tank and that equals gallons used. From there it's a straight out mpg calculation.
Last edited by superjacent; Feb 28th, 2008 at 9:56 pm. Reason: spelling.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 124
Reputation: Jboy05 is an unknown quantity at this point 
Solved Threads: 1
Jboy05 Jboy05 is offline Offline
Junior Poster

Re: Returning

 
0
  #15
Feb 28th, 2008
how would I go about using three agruments to yield the number of miles a car can travel with one gallon of gasoline
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 66
Reputation: superjacent is an unknown quantity at this point 
Solved Threads: 3
superjacent's Avatar
superjacent superjacent is offline Offline
Junior Poster in Training

Re: Returning

 
0
  #16
Feb 28th, 2008
Originally Posted by Jboy05 View Post
how would I go about using three agruments to yield the number of miles a car can travel with one gallon of gasoline
Ok, here's the formula:

miles travelled / (size of tank - gallons left) = mpg.

mpg is miles per gallon.

miles : 1000
size (gallons) : 60
left (gallons) : 10
1000 / (60-10) = 20 mpg.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 124
Reputation: Jboy05 is an unknown quantity at this point 
Solved Threads: 1
Jboy05 Jboy05 is offline Offline
Junior Poster

Re: Returning

 
0
  #17
Feb 28th, 2008
  1. double MPG ( double sizeoftank, double numberofmilest, double gasleftintank)
  2. {
  3.  
  4.  
  5. mpg=numberofmilest/(sizeoftank-gasleftintank);
  6. return mpg;
  7. }
Last edited by Jboy05; Feb 28th, 2008 at 10:22 pm.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 66
Reputation: superjacent is an unknown quantity at this point 
Solved Threads: 3
superjacent's Avatar
superjacent superjacent is offline Offline
Junior Poster in Training

Re: Returning

 
0
  #18
Feb 28th, 2008
Originally Posted by Jboy05 View Post
  1. double MPG ( double sizeoftank, double numberofmilest, double gasleftintank)
  2. {
  3.  
  4.  
  5. mpg=numberofmilest/(sizeoftank-gasleftintank);
  6. return mpg;
  7. }
Try it in a program........see what happens....
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 124
Reputation: Jboy05 is an unknown quantity at this point 
Solved Threads: 1
Jboy05 Jboy05 is offline Offline
Junior Poster

Re: Returning

 
0
  #19
Feb 28th, 2008
i got errors
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 66
Reputation: superjacent is an unknown quantity at this point 
Solved Threads: 3
superjacent's Avatar
superjacent superjacent is offline Offline
Junior Poster in Training

Re: Returning

 
0
  #20
Feb 28th, 2008
Originally Posted by Jboy05 View Post
i got errors
What were the errors.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC