c++ - 错误 C2447 和预期的声明问题

标签 c++

我修复了所有我能修复的,现在我只是想弄清楚这里出了什么问题?谁能帮我?试图找出第 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

最佳答案

在第 131 行,你有额外的 ;

void Addsomethingup(EmployeeClass Emp1, EmployeeClass Emp2, EmployeeClass Emp3);
{

这是编译器检测到的明显错误。

关于c++ - 错误 C2447 和预期的声明问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20463650/

相关文章:

c++ - 7.36 重建后 libcURL 未解析的外部

c++ - 嵌套绑定(bind)到成员,需要一个指针,得到一个引用。做什么?

c++ - 如何在现有的 json11 对象上附加属性值对(c++)?

c++ - 将 Int 转换为 LPCWSTR

c++ - 幻化多态对象

c++ - C++ 中的 Gnome N 元树用法

c++ - 如何将字符串和数字放在多维数组中?

c++ - 这个 C++ 成员初始化行为是否定义良好?

c++ - C++ 读取并显示所有文件字节

c++ - 如何在 CDateTimeCtrl 中居中对齐文本?