Help with House Program

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

Join Date: Oct 2008
Posts: 45
Reputation: zalezog is an unknown quantity at this point 
Solved Threads: 11
zalezog zalezog is offline Offline
Light Poster

Re: Help with House Program

 
0
  #11
Mar 30th, 2009
Yes you need to else you work with garbage values.

May be you didn't quite get it,by using an ampersand you actually give the function true memory addresses of

initial, fuel, taxRate

to directly make changes

If you don't use them,a COPY will be created and
initial, fuel, taxRate
won't have values which you originally entered in
void displayInstructions(..)


Since you enter these values in the function

void displayInstructions(..)
and then later use it in some other computation,don't you need the actual values which were entered in the
  1. void displayInstructions(.....) //??
And yes in main()
it should be
  1. int main()
  2. {
  3.  
  4. float initial, fuel, taxRate;
  5. displayInstructions(inintial,fuel,taxRate);//No ampesrand here
Last edited by zalezog; Mar 30th, 2009 at 4:29 pm.
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



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC