23 lines
462 B
C++
23 lines
462 B
C++
// 1. 2. 创建一个名为 Employee 的类,具有成员变量 name、id 和 salary,以及成员函数 void displayInfo() ,用于显示员工的信息。
|
||
#include <iostream>
|
||
|
||
using namespace std;
|
||
|
||
class Employee
|
||
{
|
||
public:
|
||
string name;
|
||
int id;
|
||
int salary;
|
||
void displayinfo()
|
||
{
|
||
cout << "员工信息\nid: " << this->id << "\t姓名: " << this->name << "\t薪水: " << this->salary << endl;
|
||
}
|
||
};
|
||
|
||
int main()
|
||
{
|
||
|
||
return 0;
|
||
}
|