Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <cstdio>
- using namespace std;
- class employee {
- public:
- employee(char *, long, float);
- ~employee();
- void show_employee();
- int change_salary( float);
- long get_id();
- private:
- char name[64];
- long employee_id;
- float salary;
- };
- employee::employee(char *name, long employee_id, float salary) {
- strcpy(employee::name, name);
- employee::employee_id = employee_id;
- if (salary < 50000.0) {
- employee::salary = salary;
- } else { // Недопустимый оклад
- employee::salary; // в 0.0;
- }
- }
- employee::~employee() {
- cout << "Уничтожение объекта для " << name << endl;
- }
- void employee::show_employee(void) {
- cout << "Служащий:" << name << endl;
- cout << "Номер служащего: " << employee_id << endl;
- cout << "Оклад: " << salary << endl;
- }
- int main() {
- employee worker("Happy Jamsa", 101, 10101.0);
- worker.show_employee();
- getchar();
- }
- // Лог ошибок.
- // Valentine.cpp: In constructor ‘employee::employee(char*, long int, float)’:
- // Valentine.cpp:25:19: warning: statement has no effect
- // Valentine.cpp: In function ‘int main()’:
- // Valentine.cpp:38:46: warning: deprecated conversion from string constant to ‘char*’
- // Compilation finished successfully.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement