943,793 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 795
  • C++ RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Mar 30th, 2009
0

Re: Help with House Program

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
C++ Syntax (Toggle Plain Text)
  1. void displayInstructions(.....) //??
And yes in main()
it should be
C++ Syntax (Toggle Plain Text)
  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.
Reputation Points: 53
Solved Threads: 13
Light Poster
zalezog is offline Offline
47 posts
since Oct 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Help with error C2228:
Next Thread in C++ Forum Timeline: Dynamic Memory Allocation





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC