我修复了所有我能解决的问题,现在我只想弄清楚这里有什么问题?谁能帮我?试图找出第133-1136行或130-135之间的错误,因为这是粘贴的。我被困住了,我今晚要完成这件事。我现在花了几周时间做这件事。
#include "stdafx.h"
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
//
//CLASS DECLARATION SECTION
//
class EmployeeClass
{
public:
void ImplementCalculations(string EmployeeName, int hours, double wage);
void DisplayEmployInformation(void);
void Addsomethingup(EmployeeClass Emp1, EmployeeClass Emp2, EmployeeClass Emp3);
string EmployeeName;
int hours;
double
wage;
double basepay;
int overtime_hours;
double overtime_pay;
double overtime_extra;
double iTotal_salaries;
double iIndividualSalary;
int iTotal_hours;
int iTotal_OvertimeHours;
};
int main()
{
system("cls");
cout << "\nWelcome to the Employee Pay Center\n\n";
EmployeeClass Emp1;
EmployeeClass Emp2;
EmployeeClass Emp3;
cout << "Enter the first employee's name = ";
cin >> Emp1.EmployeeName;
cout << "\nEnter the hours worked = ";
cin >> Emp1.hours;
cout << "\nEnter their hourly wage = ";
cin >> Emp1.wage;
cout << endl;
cout << "Enter the second employee's name = ";
cin >> Emp2.EmployeeName;
cout << "\nEnter the hours worked = ";
cin >> Emp2.hours;
cout << "\nEnter their hourly wage = ";
cin >> Emp2.wage;
cout << endl;
cout << "Enter the third employee's name = ";
cin >> Emp3.EmployeeName;
cout << "\nEnter the hours worked = ";
cin >> Emp3.hours;
cout << "\nEnter their hourly wage = ";
cin >> Emp3.wage;
cout << endl;
Emp1.ImplementCalculations(Emp1.EmployeeName, Emp1.hours, Emp1.wage);
Emp2.ImplementCalculations(Emp2.EmployeeName, Emp2.hours, Emp2.wage);
Emp3.ImplementCalculations(Emp3.EmployeeName, Emp3.hours, Emp3.wage);
system("pause");
return 0;
//This section you will send all three objects to a function that will add up the the following information:
//- Total Employee Salaries
//- Total Employee Hours
//- Total Overtime Hours
//The format for this function is the following:
//- Define a new object.
//- Implement function call [objectname.functionname(object name 1, object name 2, object name 3)]
} //End of Main Function
void EmployeeClass::ImplementCalculations(string EmployeeName, int hours, double wage){
//Initialize overtime variables
overtime_hours = 0;
overtime_pay = 0;
overtime_extra = 0;
if (hours > 40)
{
basepay = 40 * wage;
overtime_hours = hours - 40;
overtime_pay = wage * 1.5;
overtime_extra = overtime_hours * overtime_pay;
iIndividualSalary = overtime_extra + basepay;
} // if (hours > 40)
else
{
basepay = hours * wage;
iIndividualSalary = basepay;
}
DisplayEmployInformation();
} //End of Primary Function
void EmployeeClass::DisplayEmployInformation()
{
// This function displays all the employee output information.
cout << "\n\n";
cout << "Employee Name ............. = " << EmployeeName << endl;
cout << "Base Pay .................. = " << basepay << endl;
cout << "Hours in Overtime ......... = " << overtime_hours << endl;
cout << "Overtime Pay Amount......... = " << overtime_extra << endl;
cout << "Total Pay ................. = " << iIndividualSalary << endl;
void Addsomethingup(EmployeeClass Emp1, EmployeeClass Emp2, EmployeeClass Emp3);
} // END OF Display Employee Information
void Addsomethingup(EmployeeClass Emp1, EmployeeClass Emp2, EmployeeClass Emp3);
{ int(i = 0; i < 3; ++i)
iTotal_salaries = 0;
iTotal_hours = 0;
iTotal_OvertimeHours = 0;
for (int i = 0; i < 3; ++i)
{
cout << "\n\n";
cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;
cout << "%%%% EMPLOYEE SUMMARY DATA%%%%%%%%%%%%%%%%%%%%%%%" << endl;
cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;
cout << "%%%% Total Employee Salaries ..... =" << iTotal_salaries << endl;
cout << "%%%% Total Employee Hours ........ =" << iTotal_hours << endl;
cout << "%%%% Total Overtime Hours......... =" << iTotal_OvertimeHours << endl;
cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;
cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;
}
system("PAUSE");
return;
} // End of function
答案 0 :(得分:3)
在第131行,您有额外的;
void Addsomethingup(EmployeeClass Emp1, EmployeeClass Emp2, EmployeeClass Emp3);
{
这是编译器检测到的明显错误。
答案 1 :(得分:0)
你的for循环功能Addsomethingup应该是:
for(int i = 0; i < 3; ++i)