|
-
November 26th, 2011, 11:04 AM
#2
Re: Void functions
 Originally Posted by JohnnyLime
I'm doing some C++ homework, it's for an online class, and my ****ing teacher never answers me back about questions I have. Ultimately I'm having to do it all on my own basically. I feel like I'm close with this one (or maybe not), but a little mixed up.
Use code tags when posting code.
First, even though this is valid syntax, move these definitions before main()
Code:
void calcCommission(double, double, double, double);
void displayCommission();
void getTotalCommission();
Second, look at your functions above -- what do they return? Do they return double? No. Now look how you're calling these functions in main()
Code:
totalCommission = calcCommission (commission1, commission2, commission3, commission4);
How can a function that returns "void" return a double (you assign the return value to a double called totalCommision)? It can't -- that's why you get an error.
Hopefully the fix should be obvious to you at this point.
Regards,
Paul McKenzie
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|