//Preprocessor// #include #include #include #include #include #include #include using namespace std; //////////////////// //////Constant////// //////////////////// //////////////////// ////INTERFACE/////// //////////////////// ////////////////// ////OBJECTS/////// ////////////////// class apparate{ private: string name; float price; float termo; public: virtual float optim()=0; inline void set_name(string n){ this->name=n; } inline void set_price(float pr){ this->price=pr; } inline void set_termo(float tr){ this->termo=tr; } }; class hardware: public apparate{ private: string type; string descript; float memory; float freq; friend class ioconsole; public: hardware(){ this->freq=9; }; hardware( string t, string d, float m, float f){ this->type=t; this->descript=d; this->memory=m; this->freq=f; } virtual float optim(){ return 0; } inline set_type(string t){ this->type=t; } inline set_desc(string d){ this->descript=d; } inline set_mem(float m){ this->memory=m; } inline set_freq(float f){ this->freq=f; } }; class memory: public hardware{ private: public: }; class processor: public hardware{ private: public: }; class Computer { public: Computer() { } private: vector items; // список указателей на составляющие }; /////////////////////// /////RULE CLASSES////// /////////////////////// class store{ private: string name; ioconsole Display; hardware temp(); vector hSpisok; vector cSpisok; vector::iterator hIterator; public: store(string s){ this->name=s; } Sort(int Type); WriteBy(int Type); Print(int Type, int Number){ Display.WriteHeader(Type); if (type) Display.Write(&hSpisok[number]) else Display.Write(&cSpisok[number]) }; PrintAll(int Type); Add(int Type); }; // MENU // class menu{ public: void Start(){ //INIT// store CompServ("Computer Servise; 28, Moscow street"); //LOOP// cout << "PUT Some key" << endl; cout << "F1 - vvod hardware F2 - vivod vse F10 - EXIT" << endl; int key; while(1){ key = getch(); switch (key){ case 59: ; break; case 60: CompServ.PrintAll(2); break; case 68: CompServ.Add(2); exit(0); } } } }; class ioconsole{ private: public: void cls(){ HANDLE hConsole; CONSOLE_SCREEN_BUFFER_INFO csInfo; DWORD dummy; COORD Home={0,0}; hConsole=GetStdHandle(STD_OUTPUT_HANDLE); GetConsoleScreenBufferInfo(hConsole, &csInfo); FillConsoleOutputCharacter(hConsole,' ',csInfo.dwSize.X*csInfo.dwSize.Y,Home,&dummy); SetConsoleCursorPosition(hConsole,Home); printf("\nComputer Magazine\n"); printf(" \n"); } void PrintAll(vector &h){ for (int i=1; i<10; i++){ cout << endl; } } void Print(template h){ cout << h.type << " - " << h.descript <<" - " << h.memory << " - " << h.freq << endl; } void AddHard(vector &h){ hardware temp; string temp1; float temp2; cin >> temp1; temp.set_name(temp1); cin >> temp1; temp.set_desc(temp1); cin >> temp2; temp.set_mem(temp2); cin >> temp2; temp.set_freq(temp2); } }; /////////////// /////MAIN////// /////////////// int main(){ menu MyMenu; MyMenu.Start(); return 0; };