Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class transport{
- string transport;
- public:
- void set(string transport){
- this->transport = transport;
- }
- string transp(){
- return transport;
- }
- };
- class train : public transport{
- int vagon;
- public:
- void set1(int vagon){
- this->vagon = vagon;
- }
- int vag(){
- return vagon;
- }
- };
- class driver : public train{
- string name, gender;
- int age;
- public:
- void set2(string name, string gender){
- this->name = name;
- this->gender = gender;
- }
- void set22(int age){
- this->age = age;
- }
- string nname(){
- return name;
- }
- string gend(){
- return gender;
- }
- int ag(){
- return age;
- }
- };
- class electr_driver : public driver{
- int time, cash;
- public:
- void set3(int time, int cash){
- this->time = time;
- this->cash = cash;
- }
- int money(){
- return cash;
- }
- int tim(){
- return time;
- }
- };
- class long_driver : public driver{
- int cash, time;
- public:
- void set4(int time, int cash){
- this->cash = cash;
- this->time = time;
- }
- int mon1(){
- return cash;
- }
- int time1(){
- return time;
- }
- };
- int main() {
- long_driver one;
- one.set("Поезд дальнего следования");
- cout << "Работник водит : " << one.transp() << endl;
- one.set1(6);
- cout << "В поезде " << one.vag() << " вагонов" << endl;
- one.set2("Михайлов Даниил Игоревич", "Мужской");
- one.set22(45);
- cout << "ФИО: " << one.nname() << endl;
- cout << "Пол: " << one.gend() << endl;
- cout << "Возраст: " << one.ag() << endl;
- one.set4(500, 75000);
- cout << "Время работы в месяц: " << one.time1() << endl;
- cout << "Зарплата: " << one.mon1() << endl;
- cout << endl;
- long_driver two;
- two.set("Поезд дальнего следования");
- cout << "Работник водит : " << two.transp() << endl;
- two.set1(12);
- cout << "В поезде " << two.vag() << " вагонов" << endl;
- two.set2("Иванов Сергей Дмитриевич", "Мужской");
- two.set22(55);
- cout << "ФИО: " << two.nname() << endl;
- cout << "Пол: " << two.gend() << endl;
- cout << "Возраст: " << two.ag() << endl;
- two.set4(650, 130000);
- cout << "Время работы в месяц: " << two.time1() << endl;
- cout << "Зарплата: " << two.mon1() << endl;
- cout << endl;
- electr_driver three;
- three.set("Электричка");
- cout << "Работник водит: " << three.transp() << endl;
- three.set1(4);
- cout << "В электричке " << three.vag() << " вагонов" << endl;
- three.set2("Любимова Оксана Эдуардовна", "Женский");
- three.set22(48);
- cout << "ФИО: " << three.nname() << endl;
- cout << "Пол: " << three.gend() << endl;
- cout << "Возраст: " << three.ag() << endl;
- three.set3(350, 60000);
- cout << "Время работы в месяц " << three.tim() << endl;
- cout << "Зарплата: " << three.money() << endl;
- cout << endl;
- electr_driver four;
- four.set("Электричка");
- cout << "Работник водит: " << four.transp() << endl;
- four.set1(7);
- cout << "В электричке " << four.vag() << " вагонов" << endl;
- four.set2("Денисов Максим Викторович", "Мужской");
- four.set22(35);
- cout << "ФИО: " << four.nname() << endl;
- cout << "Пол: " << four.gend() << endl;
- cout << "Возраст: " << four.ag() << endl;
- four.set3(410, 90000);
- cout << "Время работы в месяц " << four.tim() << endl;
- cout << "Зарплата: " << four.money() << endl;
- cout << endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment