一个致命错误c++

来源:百度知道 编辑:UC知道 时间:2024/05/09 15:37:25
#include <iostream.h>
class employee
{
char strName [50]; //姓名
int base ; //基本工资
int overtime_hours ; //加班小时数
double overtime_salary ; //加班每小时薪水
double traffic_fee ; //交通费
double Salary() //来计算基本工资加加班工资
{

dSalary = base + overtime_hours*overtime_salary ;
return dSalary ;
}
double Allowance(double salary) //用来计算津贴
{
return (traffic_fee + salary*0.1 ) ;
}
void InitData()
{
//数据初始化
strName[0] = '\0' ;
base = 0;
overtime_hours = 0 ;
overtime_salary = 60.0 ;
traffic_fee = 150 ;
}
void InputData()
{
//获取数据
cout <<"输入姓名: " <<endl;
cin >> strName ;
cout <<"输入工资: "<<endl
cin >>base ;
cout <<"输入加班小时数: "<<endl ;
cin >> overtime_hours ;

}

int main() 之前差了个括号,用来结束类的,
与class employee
{
对应。

class的定义应该如下:
class name
{
***
};//你掉了这一行
另外,数据成员不要设为公有,注意格式

在类 employee定义的结尾需加"}"