|
-
November 25th, 2011, 06:18 PM
#1
Void functions
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. I'm getting an "in function int main" error but don't know where, and "void value not ignored as it ought to be" error on the line: "totalCommission = calcCommission (commission1, commission2, commission3, commission4)". Can anyone help?
------------------------------------------------------------------------------------------------
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
const double commission = 0.1;
double salesAmount = 0.0;
double totalCommission = 0.0;
double sale1 = 0.0;
double sale2 = 0.0;
double sale3 = 0.0;
double sale4 = 0.0;
double commission1 = 0.0;
double commission2 = 0.0;
double commission3 = 0.0;
double commission4 = 0.0;
void calcCommission(double, double, double, double);
void displayCommission();
void getTotalCommission();
cout << "Enter first saleman's total sales: ";
cin >> sale1;
cout << "Enter second saleman's total sales: ";
cin >> sale2;
cout << "Enter third saleman's total sales: ";
cin >> sale3;
cout << "Enter fourth saleman's total sales: ";
cin >> sale4;
salesAmount = sale1 + sale2 + sale3 + sale4;
cout << "Total sales: " << salesAmount << endl;
totalCommission = calcCommission (commission1, commission2, commission3, commission4);
cout << "Commission: " << totalCommission << endl;
system("pause");
return 0;
}
---------------------------------------------------------------------------------------------------
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
|