Фирма
vilgos Дата: Пн, 06 Июл 2015, 17:22 | Сообщение # 1
Старший программист
Группа: Модераторы
Сообщений: 76
Статус: Offline
.h
Код
// stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #pragma once #include "targetver.h" #include <stdio.h> #include <tchar.h> #include <iostream> #include <string> #include <Windows.h> #include <time.h> using namespace std; // TODO: reference additional headers your program requires here
.cpp
Код
// stdafx.cpp : source file that includes just the standard includes // testFirma.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" // TODO: reference any additional headers you need in STDAFX.H // and not in this file
Код
// testFirma.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "SysAdminP1.h" #include "SysAdminP2.h" #include "ProgramerP1.h" #include "ProgramerP2.h" #include "MenegerP1.h" #include "MenegerP2.h" int r1=0; int r2=0; int r3=0; int r4=0; int r5=0; int r6=0; void RRR(); int _tmain(int argc, _TCHAR* argv[]) { srand(time(NULL)); string name[] = { "Vasya", "Petya", "Kostya", "Max", "Igor'", "Pasha", "Vitya", "Vadim" }; int age[8]; int rost[8]; int zarplata[8]; for (int i = 0; i < 8; i++){ age [i]= rand() % 20+20; rost [i]= rand() % 50+150; zarplata [i]= rand() % 5000 + 2000; } string dolzhnost[] = { "starshiy_sysadmin", "mladshiy_sysadmin", "teamlid","sekretar","nachalnik" }; string lvl[] = { "Junior", "Middle", "Senior" }; RRR(); SysAdminP1 A(name[r1],age[r2],rost[r3],zarplata[r4],dolzhnost[r5],rand()%3+1,lvl[r6]); RRR(); SysAdminP2 B(name[r1], age[r2], rost[r3], zarplata[r4], dolzhnost[r5], rand() % 3 + 1, lvl[r6]); RRR(); ProgramerP1 C(name[r1], age[r2], rost[r3], zarplata[r4], dolzhnost[r5], rand() % 3 + 1, lvl[r6]); RRR(); ProgramerP2 D(name[r1], age[r2], rost[r3], zarplata[r4], dolzhnost[r5], rand() % 3 + 1, lvl[r6]); RRR(); MenegerP1 M1("Masha", age[r2], rost[r3], zarplata[r4], dolzhnost[3], rand() % 99 + 1, rand() % 99 + 1); RRR(); MenegerP2 M2(name[r1], age[r2], rost[r3], zarplata[r4], dolzhnost[4], rand() % 99 + 1, rand() % 99 + 1); while (true) { system("cls"); cout << "pokazat' vsex-1, programerov-2, sysadminov-3, meneger-4, exit-9" << endl; int a = _gettch(); int bottom1 = 0; switch (a) { case 49: cout << "1 - "; A.getValue(1); cout << "2 - "; B.getValue(1); cout << "3 - "; C.getValue(1); cout << "4 - "; D.getValue(1); cout << "5 - "; M1.getValue(1); cout << "6 - "; M2.getValue(1); cout << "nazad-9, vibor 1-6" << endl; bottom1 = _gettch(); cout << "------------------------------"<<endl; switch (bottom1) { case 49: A.getValue(); break; case 50: B.getValue(); break; case 51: C.getValue(); break; case 52: D.getValue(); break; case 53: M1.getValue(); break; case 54: M2.getValue(); break; case 57: break; default: break; } bottom1 = 0; cout << "Press any key..."; _gettch(); break; case 50: cout << "1 - "; C.getValue(1); cout << "2 - "; D.getValue(1); cout << "nazad-9, vibor 1-2" << endl; bottom1 = _gettch(); cout << "------------------------------" << endl; switch (bottom1) { case 49: C.getValue(); break; case 50: D.getValue(); break; case 57: break; default: break; } bottom1 = 0; cout << "Press any key..."; _gettch(); break; case 51: cout << "1 - "; A.getValue(1); cout << "2 - "; B.getValue(1); cout << "nazad-9, vibor 1-2" << endl; bottom1 = _gettch(); cout << "------------------------------" << endl; switch (bottom1) { case 49: A.getValue(); break; case 50: B.getValue(); break; case 57: break; default: break; } bottom1 = 0; cout << "Press any key..."; _gettch(); break; case 52: cout << "1 - "; M1.getValue(1); cout << "2 - "; M2.getValue(1); cout << "nazad-9, vibor 1-2" << endl; bottom1 = _gettch(); cout << "------------------------------" << endl; switch (bottom1) { case 49: M1.getValue(); break; case 50: M2.getValue(); break; case 57: break; default: break; } bottom1 = 0; cout << "Press any key..."; _gettch(); break; case 57: exit(0); default: break; } } A.getValue(); B.getValue(); C.getValue(); D.getValue(); cout << endl << endl; A.getValue(1); B.getValue(1); C.getValue(1); D.getValue(1); _gettch(); return 0; } void RRR(){ r1 = rand() % 7; r2 = rand() % 7; r3 = rand() % 7; r4 = rand() % 7; r5 = rand() % 2; r6 = rand() % 2; }
интерфейсы
.h
Код
#pragma once class Meneger { public: Meneger(); virtual ~Meneger(); void virtual getValue() = 0; protected: int lvlOffise; int lvlPC; };
.cpp
Код
#include "stdafx.h" #include "Meneger.h" Meneger::Meneger() { } Meneger::~Meneger() { }
.h
Код
#pragma once class Programer { public: Programer(); virtual ~Programer(); void virtual getValue() = 0; protected: int kvo9zikovPorgram; string lvlVladeni9; };
.cpp
Код
#include "stdafx.h" #include "Programer.h" Programer::Programer() { } Programer::~Programer() { }
.h
Код
#pragma once class SysAdmin { public: SysAdmin(); SysAdmin(int kvoOsvoenihOS, string lvlOsvoeni9); virtual ~SysAdmin(); void virtual getValue() = 0; protected: int kvoOsvoenihOS; string lvlOsvoeni9; };
.cpp
Код
#include "stdafx.h" #include "SysAdmin.h" SysAdmin::SysAdmin() { } SysAdmin::~SysAdmin() { }
vilgos Дата: Пн, 06 Июл 2015, 17:22 | Сообщение # 2
Старший программист
Группа: Модераторы
Сообщений: 76
Статус: Offline
классы
.h
Код
#pragma once class GeneralInfo { public: GeneralInfo(); ~GeneralInfo(); void getValue(); void getValue(int a); protected: string name; int age; int rost; int zarplata; string dolzhnost; };
.cpp
Код
#include "stdafx.h" #include "GeneralInfo.h" GeneralInfo::GeneralInfo() { } GeneralInfo::~GeneralInfo() { } void GeneralInfo::getValue(){ cout << "im9 " << this->name << endl; cout << "vozrast " << this->age << endl; cout << "dolzhnost " << this->dolzhnost << endl; cout << "rost " << this->rost << endl; cout << "zarplata " << this->zarplata << endl; } void GeneralInfo::getValue(int a){ cout << "im9 " << this->name << endl; }
.h
Код
#pragma once #include "Meneger.h" #include "GeneralInfo.h" class MenegerP1 : public virtual Meneger, public virtual GeneralInfo { public: MenegerP1(); ~MenegerP1(); MenegerP1(string name, int age, int rost, int zarplata, string dolzhnost, int lvlOffice, int lvlPC); void getValue(); void getValue(int a); void coffe(); };
.cpp
Код
#include "stdafx.h" #include "MenegerP1.h" MenegerP1::MenegerP1() { } MenegerP1::~MenegerP1() { } MenegerP1::MenegerP1(string name, int age, int rost, int zarplata, string dolzhnost, int lvlOffice, int lvlPC){ this->lvlOffise = lvlOffice; this->lvlPC = lvlPC; this->name = name; this->age = age; this->dolzhnost = dolzhnost; this->rost = rost; this->zarplata = zarplata; } void MenegerP1::coffe(){ cout << "Ymeet gotovit horoshij coffe.\n Progotovit'? 1-da, drygoe-net" << endl; int a = _gettch(); if (a == 49) cout << "Vash coffe gotov!"<<endl; else cout << "Poka" << endl; } void MenegerP1::getValue(){ GeneralInfo::getValue(); cout << "yroven' osvoeni9 PC " << this->lvlPC << endl; cout << "yroven' osvoeni9 office " << this->lvlOffise << endl; MenegerP1::coffe(); cout << endl; } void MenegerP1::getValue(int a){ GeneralInfo::getValue(a); }
.h
Код
#pragma once #include "Meneger.h" #include "GeneralInfo.h" class MenegerP2 : public virtual Meneger, public virtual GeneralInfo { public: MenegerP2(); MenegerP2(string name, int age, int rost, int zarplata, string dolzhnost, int lvlOffice, int lvlPC); ~MenegerP2(); void getValue(); void getValue(int a); void boss(); };
.cpp
Код
#include "stdafx.h" #include "MenegerP2.h" MenegerP2::MenegerP2() { } MenegerP2::~MenegerP2() { } MenegerP2::MenegerP2(string name, int age, int rost, int zarplata, string dolzhnost, int lvlOffice, int lvlPC){ this->lvlOffise = lvlOffice; this->lvlPC = lvlPC; this->name = name; this->age = age; this->dolzhnost = dolzhnost; this->rost = rost; this->zarplata = zarplata; } void MenegerP2::boss(){ cout << "Ymeet zakliychat' sdelki.\n Zakliychit''? 1-da, drygoe-net" << endl; int a = _gettch(); if (a == 49) cout << "Sdelca s AMD zakliychena. Intel obozlils9!" << endl; else cout << "Poka" << endl; } void MenegerP2::getValue(){ GeneralInfo::getValue(); cout << "yroven' osvoeni9 PC " << this->lvlPC << endl; cout << "yroven' osvoeni9 office " << this->lvlOffise << endl; MenegerP2::boss(); cout << endl; } void MenegerP2::getValue(int a){ GeneralInfo::getValue(a); }
vilgos Дата: Пн, 06 Июл 2015, 17:33 | Сообщение # 3
Старший программист
Группа: Модераторы
Сообщений: 76
Статус: Offline
.h
Код
#pragma once #include "Programer.h" #include "GeneralInfo.h" class ProgramerP1 : public virtual Programer, public virtual GeneralInfo { public: ProgramerP1(); ProgramerP1(string name, int age, int rost, int zarplata, string dolzhnost, int kvo9zikovPorgram, string lvlVladeni9); ~ProgramerP1(); void getValue(); void getValue(int a); void micro(); };
.cpp
Код
#include "stdafx.h" #include "ProgramerP1.h" ProgramerP1::ProgramerP1() { } ProgramerP1::ProgramerP1(string name, int age, int rost, int zarplata, string dolzhnost, int kvo9zikovPorgram, string lvlVladeni9){ this->kvo9zikovPorgram = kvo9zikovPorgram; this->lvlVladeni9 = lvlVladeni9; this->name = name; this->age = age; this->dolzhnost = dolzhnost; this->rost = rost; this->zarplata = zarplata; } void ProgramerP1::micro(){ cout << "Yneet programirovat' microkontroleri.\n Zaprogramirovat' nikrokontroleri robota? 1-da, drygoe-net" << endl; int a = _gettch(); if (a == 49) cout << "Vash robot gotov!" << endl; else cout << "Poka" << endl; } void ProgramerP1::getValue(){ GeneralInfo::getValue(); cout << "osvoeno 9zikov Porgramirovani9 " << this->kvo9zikovPorgram << endl; cout << "yroven' osvoeni9 " << this->lvlVladeni9 << endl; ProgramerP1::micro(); cout << endl; } void ProgramerP1::getValue(int a){ GeneralInfo::getValue(a); } ProgramerP1::~ProgramerP1() { }
.h
Код
#pragma once #include "Programer.h" #include "GeneralInfo.h" class ProgramerP2 : public virtual Programer, public virtual GeneralInfo { public: ProgramerP2(); ProgramerP2(string name, int age, int rost, int zarplata, string dolzhnost, int kvo9zikovPorgram, string lvlVladeni9); ~ProgramerP2(); void getValue(); void getValue(int a); void AVR(); };
.cpp
Код
#include "stdafx.h" #include "ProgramerP2.h" ProgramerP2::ProgramerP2() { } ProgramerP2::ProgramerP2(string name, int age, int rost, int zarplata, string dolzhnost, int kvo9zikovPorgram, string lvlVladeni9){ this->kvo9zikovPorgram = kvo9zikovPorgram; this->lvlVladeni9 = lvlVladeni9; this->name = name; this->age = age; this->dolzhnost = dolzhnost; this->rost = rost; this->zarplata = zarplata; } void ProgramerP2::AVR(){ cout << "Yneet programirovat' na AVR.\n Zaprogramirovat' signalizatsijy? 1-da, drygoe-net" << endl; int a = _gettch(); if (a == 49) cout << "Vasha signalizatsiya gotova!" << endl; else cout << "Poka" << endl; } void ProgramerP2::getValue(){ GeneralInfo::getValue(); cout << "osvoeno 9zikov Porgramirovani9 " << this->kvo9zikovPorgram << endl; cout << "yroven' osvoeni9 " << this->lvlVladeni9 << endl; ProgramerP2::AVR(); cout << endl; } void ProgramerP2::getValue(int a){ GeneralInfo::getValue(a); } ProgramerP2::~ProgramerP2() { }
vilgos Дата: Пн, 06 Июл 2015, 17:37 | Сообщение # 4
Старший программист
Группа: Модераторы
Сообщений: 76
Статус: Offline
.h
Код
#pragma once #include "SysAdmin.h" #include "GeneralInfo.h" class SysAdminP1 : public virtual SysAdmin, public virtual GeneralInfo { public: SysAdminP1(); SysAdminP1(string name, int age, int rost, int zarplata, string dolzhnost, int kvoOsvoenihOS, string lvlOsvoeni9); ~SysAdminP1(); void getValue(); void getValue(int a); void piton(); };
.cpp
Код
#include "stdafx.h" #include "SysAdminP1.h" SysAdminP1::SysAdminP1() { } SysAdminP1::SysAdminP1(string name, int age, int rost, int zarplata, string dolzhnost, int kvoOsvoenihOS, string lvlOsvoeni9){ this->kvoOsvoenihOS = kvoOsvoenihOS; this->lvlOsvoeni9 = lvlOsvoeni9; this->name = name; this->age = age; this->dolzhnost = dolzhnost; this->rost = rost; this->zarplata = zarplata; } SysAdminP1::~SysAdminP1() { } void SysAdminP1:iton(){ cout << "Yneet programirovat' na pitone.\n Zaprogramirovat' scripty dlya saita? 1-da, drygoe-net" << endl; int a = _gettch(); if (a == 49) cout << "Vashi skripty gotovy!" << endl; else cout << "Poka" << endl; } void SysAdminP1::getValue(){ GeneralInfo::getValue(); cout << "osvoeno OS " << this->kvoOsvoenihOS << endl; cout << "yroven' osvoeni9 " << this->lvlOsvoeni9 << endl; SysAdminP1:iton(); cout << endl; } void SysAdminP1::getValue(int a){ GeneralInfo::getValue(a); }
.h
Код
#pragma once #include "SysAdmin.h" #include "GeneralInfo.h" class SysAdminP2 : public virtual SysAdmin, public virtual GeneralInfo { public: SysAdminP2(); SysAdminP2(string name, int age, int rost, int zarplata, string dolzhnost, int kvoOsvoenihOS, string lvlOsvoeni9); ~SysAdminP2(); void getValue(); void getValue(int a); void apach(); };
.cpp
Код
#include "stdafx.h" #include "SysAdminP2.h" SysAdminP2::SysAdminP2() { } SysAdminP2::SysAdminP2(string name, int age, int rost, int zarplata, string dolzhnost, int kvoOsvoenihOS, string lvlOsvoeni9){ this->kvoOsvoenihOS = kvoOsvoenihOS; this->lvlOsvoeni9 = lvlOsvoeni9; this->name = name; this->age = age; this->dolzhnost = dolzhnost; this->rost = rost; this->zarplata = zarplata; } SysAdminP2::~SysAdminP2() { } void SysAdminP2::apach(){ cout << "Yneet stavit' apache.\n Postavit' server? 1-da, drygoe-net" << endl; int a = _gettch(); if (a == 49) cout << "Vash server gotov!" << endl; else cout << "Poka" << endl; } void SysAdminP2::getValue(){ GeneralInfo::getValue(); cout << "osvoeno OS " << this->kvoOsvoenihOS << endl; cout << "yroven' osvoeni9 " << this->lvlOsvoeni9 << endl; SysAdminP2::apach(); cout << endl; } void SysAdminP2::getValue(int a){ GeneralInfo::getValue(a); }