qfedu-cpp-level/day2/homework/h8.cpp

23 lines
462 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 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;
}