RSS Forums RSS
Please support our C++ advertiser: Programming Forums

struct functions - lost a wee bit (i hope) in calling the functions

Join Date: Apr 2006
Location: Canada
Posts: 4,545
Reputation: John A is a name known to all John A is a name known to all John A is a name known to all John A is a name known to all John A is a name known to all John A is a name known to all 
Rep Power: 17
Solved Threads: 284
Moderator
Featured Blogger
John A's Avatar
John A John A is offline Offline
Vampirical Moderator

Re: struct functions - lost a wee bit (i hope) in calling the functions

  #2  
Mar 29th, 2007
First of all, trash these globals at the top of the program!
  1. double quiz1;
  2. double quiz2;
  3. double midtermExam;
  4. double finalExam;
  5. double courseAverage;

That's why you made a struct. So you wouldn't have to use globals. If you need to modify values inside one of your functions, use references or pointers. That's what they're there for.

Also, don't put the function's return type when calling. For example, this is wrong in main():
  1. void inputRecord (StudentRecord.record);
Another thing is that when you're passing record, it's just that: record. You don't need to prefix it with StudentRecord. .

And don't forget that you need to pass a reference to inputRecord. Otherwise you'll just lose the values that the user inputted when the function returns.
tuxation.com - Linux articles, tutorials, and discussions
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 10:01 am.
Newsletter Archive - Sitemap - Privacy Statement - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC