-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex04.cpp
More file actions
45 lines (39 loc) · 970 Bytes
/
Copy pathex04.cpp
File metadata and controls
45 lines (39 loc) · 970 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <iostream>
using namespace std;
class employee {
private:
int number;
float compensation;
public:
employee() : number(0), compensation(0) {
}
employee(int n, float c) : number(n), compensation(c) {
}
void setData();
void display()const;
};
void employee::setData() {
cout << "Введите номер сотрудника: ";
cin >> number;
cout << "Введите величину пособия: ";
cin >> compensation;
cout << endl;
}
void employee::display() const {
cout << "Номер cотрудника: " << number << endl;
cout << "Величина пособия: $" << compensation << endl;
}
int main() {
employee emp1, emp2;
employee emp3(74, 50);
emp1.setData();
emp2.setData();
cout << "\nСотрудник #1: ";
emp1.display();
cout << "\nСотрудник #2: ";
emp2.display();
cout << "\nСотрудник #3: ";
emp3.display();
cout << endl;
return 0;
}