├── Colocviu 2014 ├── adultsub40.h ├── adultpeste40.h ├── copil.h ├── cabinet.h ├── pacient.h ├── main.cpp ├── adultsub40.cpp ├── pacient.cpp ├── adultpeste40.cpp ├── copil.cpp └── cabinet.cpp ├── Vector ├── main.cpp └── vector.h ├── Hotel Booking System ├── main.cpp ├── twin_room.h ├── room.h ├── quadruble_room.h ├── restaurant.h ├── individual_c_room.h ├── stage_room.h ├── person.h ├── group.h └── hotel.h └── Stack ├── project1.cpp ├── node.h └── stack.h /Colocviu 2014/adultsub40.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pacient.h" 3 | 4 | class Adultsub40: public Pacient{ 5 | public: 6 | Adultsub40(std::string = "", std::string = "", int = 0, double = 0, double = 0, std::string = "", std::string = ""); 7 | Adultsub40(const Adultsub40 &); 8 | Adultsub40& operator=(const Adultsub40&); 9 | ~Adultsub40(); 10 | 11 | virtual void citire(); 12 | virtual void afisare(); 13 | virtual std::string gradRiscCardiovascular(); 14 | std::string getType(); 15 | }; -------------------------------------------------------------------------------- /Colocviu 2014/adultpeste40.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pacient.h" 3 | 4 | class Adultpeste40: public Pacient{ 5 | std::string fumator; 6 | std::string sedentarism; 7 | public: 8 | Adultpeste40(std::string = "", std::string = "", int = 0, double = 0, double = 0, std::string = "", std::string = "", std::string = "", std::string = ""); 9 | Adultpeste40(const Adultpeste40 &); 10 | Adultpeste40& operator=(const Adultpeste40&); 11 | ~Adultpeste40(); 12 | 13 | virtual void citire(); 14 | virtual void afisare(); 15 | virtual std::string gradRiscCardiovascular(); 16 | std::string getType(); 17 | }; -------------------------------------------------------------------------------- /Vector/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "vector.h" 3 | 4 | int main() 5 | { 6 | /*Vector a(3,4); 7 | a.push_back(5); 8 | a.push_back(10); 9 | a.push_back(6); 10 | 11 | a.clear(); 12 | 13 | Vector b(4, 10), c(b); 14 | a = b; 15 | a[0] = 11; 16 | a[3] = 9; 17 | 18 | a.insert(0,10); 19 | std::cout << a.front() << "\n"; 20 | b.erase(3); 21 | std::cout << b.back() << "\n"; 22 | 23 | std::cout << a.size() << "\n"; 24 | a.resize(7,3); 25 | std::cout << a.size() << "\n"; 26 | std::cout << b.capacity() << "\n"; 27 | b.rezerve(10); 28 | std::cout << b.capacity() << "\n"; 29 | 30 | return 0;*/ 31 | } -------------------------------------------------------------------------------- /Hotel Booking System/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hotel.h" 3 | #include "group.h" 4 | 5 | 6 | int main() 7 | { 8 | Hotel H; 9 | H.readData(std::cin); 10 | 11 | Group G; 12 | while(1) 13 | { 14 | int exit = 0; 15 | H.introduction(); 16 | 17 | int choice; 18 | std::cin >> choice; 19 | switch(choice) 20 | { 21 | case 1: 22 | std::cin >> G; 23 | H.request_reservation(G); 24 | break; 25 | 26 | case 2: 27 | H.writeData(std::cout); 28 | break; 29 | 30 | case 3: 31 | exit = 1; 32 | 33 | default: 34 | break; 35 | } 36 | if(exit == 1) 37 | { 38 | break; 39 | } 40 | } 41 | 42 | return 0; 43 | } -------------------------------------------------------------------------------- /Colocviu 2014/copil.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pacient.h" 3 | 4 | class Copil: public Pacient{ 5 | std::string antecedentefamilie; 6 | std::string numeMama; 7 | std::string numeTata; 8 | std::string dataProteinaC; 9 | double proteinaC; 10 | public: 11 | Copil(std::string = "", std::string = "", int = 0, double = 0, double = 0, std::string = "", std::string = "", std::string = "", std::string = "", std::string = "", std::string = "", double = 0); 12 | Copil(const Copil &); 13 | Copil& operator=(const Copil&); 14 | ~Copil(); 15 | 16 | virtual void citire(); 17 | virtual void afisare(); 18 | virtual std::string gradRiscCardiovascular(); 19 | std::string getType(); 20 | }; -------------------------------------------------------------------------------- /Stack/project1.cpp: -------------------------------------------------------------------------------- 1 | #include "node.h" 2 | #include "stack.h" 3 | #include 4 | 5 | int main() 6 | { 7 | /*Stack s1, s2; 8 | 9 | //reading input from console 10 | std::cin >> s1; 11 | std::cin >> s2; 12 | 13 | //printing output to console 14 | std::cout << s1; 15 | 16 | //calling methods of Stack class 17 | s2.clear(); 18 | s2.push(9); 19 | s2.pop(); 20 | s2.push(10); 21 | s2.push(11); 22 | 23 | s1.push(12); 24 | s1.push(13); 25 | s1.push(14); 26 | s1.push(15); 27 | s1.pop(); 28 | 29 | std::cout << (s2 == s1) << "\n"; 30 | s1.pop(); 31 | std::cout << (s2 < s1) << "\n"; 32 | 33 | std::cout << s2.top() << "\n"; 34 | std::cout << s2.empty() << " " << s2.size() << "\n"; 35 | 36 | return 0;*/ 37 | } -------------------------------------------------------------------------------- /Colocviu 2014/cabinet.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include "pacient.h" 5 | 6 | class Cabinet{ //SINGLETON 7 | private: 8 | std::string numeDoctor; 9 | std::string adresa; 10 | static Cabinet* instance; 11 | Cabinet(std::string = "", std::string = ""); 12 | std::vector pacienti; 13 | 14 | public: 15 | static Cabinet* getInstance(std::string, std::string); 16 | std::string getNumeDoctor(); 17 | void setNumeDoctor(std::string); 18 | std::string getAdresa(); 19 | void setAdresa(std::string); 20 | void mesaj(); 21 | void adaugaPacient(std::string); 22 | void afiseazaPacienti(); 23 | void afiseazaPacient(int); 24 | void afiseazaPacientiNume(std::string); 25 | void afiseazaAdultiRiscRidicat(); 26 | void afiseazaCopiiRisc(); 27 | }; -------------------------------------------------------------------------------- /Colocviu 2014/pacient.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | class Pacient{ 5 | private: 6 | static int contor; 7 | protected: 8 | std::string nume; 9 | std::string prenume; 10 | int varsta; 11 | double colesterol; 12 | double tensiuneArteriala; 13 | std::string datacolesterol; 14 | std::string datatensiune; 15 | int id; 16 | public: 17 | Pacient(std::string = "", std::string = "", int = 0, double = 0, double = 0, std::string = "", std::string = ""); 18 | Pacient(const Pacient &); 19 | Pacient& operator=(const Pacient&); 20 | virtual ~Pacient(); 21 | 22 | virtual void citire() = 0; 23 | virtual void afisare() = 0; 24 | virtual std::string gradRiscCardiovascular() = 0; 25 | virtual std::string getType() = 0; 26 | 27 | int getId() const; 28 | std::string getNume() const; 29 | 30 | }; -------------------------------------------------------------------------------- /Colocviu 2014/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "cabinet.h" 3 | 4 | int main(){ 5 | 6 | Cabinet *C = C->getInstance("Strada X NR. Y", "Popescu Ion"); 7 | while(true){ 8 | C->mesaj(); 9 | int alegere; 10 | std::cin >> alegere; 11 | 12 | if(alegere == 1){ 13 | C->afiseazaPacienti(); 14 | } 15 | if(alegere == 2){ 16 | C->afiseazaAdultiRiscRidicat(); 17 | } 18 | if(alegere == 3){ 19 | C->afiseazaCopiiRisc(); 20 | } 21 | if(alegere == 4){ 22 | std::cout << "Introduce nume:\n"; 23 | std::string nume; 24 | std::cin >> nume; 25 | C->afiseazaPacientiNume(nume); 26 | } 27 | if(alegere == 5){ 28 | std::cout << "Clientul este adult sub 40 de ani, adult peste 40 de ani sau copil?\n"; 29 | std::string tipPacient; 30 | std::cin >> tipPacient; 31 | C->adaugaPacient(tipPacient); 32 | } 33 | if(alegere == 6){ 34 | std::cout << "Ai ales sa iesi din meniu."; 35 | break; 36 | } 37 | if(alegere < 1 or alegere > 6){ 38 | std::cout << "Tasta incorecta."; 39 | } 40 | std::cout << "\n"; 41 | } 42 | } -------------------------------------------------------------------------------- /Hotel Booking System/twin_room.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "room.h" 3 | 4 | class TwinRoom: public Room 5 | { 6 | private: 7 | const static int numberBeds = 2; 8 | int price; 9 | public: 10 | TwinRoom(int = 0); 11 | TwinRoom(const TwinRoom&); 12 | TwinRoom& operator=(const TwinRoom&); 13 | ~TwinRoom(); 14 | 15 | int getCapacity(); 16 | 17 | virtual std::string type() const; 18 | virtual void readData(std::istream&); 19 | virtual void writeData(std::ostream&); 20 | }; 21 | 22 | TwinRoom::TwinRoom(int price_p) : Room(), price(price_p) {} 23 | 24 | TwinRoom::TwinRoom(const TwinRoom& TR) : Room(TR), price(TR.price) {} 25 | 26 | TwinRoom& TwinRoom::operator=(const TwinRoom& TR) 27 | { 28 | this->Room::operator=(TR); 29 | this->price = TR.price; 30 | return *this; 31 | } 32 | 33 | TwinRoom::~TwinRoom() 34 | { 35 | this->price = 0; 36 | } 37 | 38 | std::string TwinRoom::type() const 39 | { 40 | return "TwinRoom"; 41 | } 42 | 43 | void TwinRoom::readData(std::istream& input) 44 | { 45 | std::cout << "\nEnter the price of a twin room.\n"; 46 | input >> price; 47 | } 48 | 49 | void TwinRoom::writeData(std::ostream& output) 50 | { 51 | output << "\nThe price of a twin room is " << price << ".\n"; 52 | } 53 | 54 | int TwinRoom::getCapacity() 55 | { 56 | return numberBeds; 57 | } 58 | -------------------------------------------------------------------------------- /Hotel Booking System/room.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | class Room 5 | { 6 | public: 7 | static int numberRooms; 8 | std::vectorbusyRoom = std::vector(367,0); 9 | public: 10 | Room(); 11 | Room(const Room&); 12 | Room& operator=(const Room&); 13 | virtual ~Room(); 14 | 15 | virtual std::string type() const = 0; 16 | virtual void readData(std::istream&) = 0; 17 | virtual void writeData(std::ostream&) = 0; 18 | virtual int getCapacity() = 0; 19 | 20 | void setBusyRoom(int, bool); 21 | bool getBusyRoom(int); 22 | 23 | }; 24 | int Room::numberRooms = 0; 25 | 26 | Room::Room() 27 | { 28 | this->numberRooms++; 29 | } 30 | 31 | Room::Room(const Room& R) 32 | { 33 | this->numberRooms++; 34 | for(int i = 1; i <= 365; i++) 35 | { 36 | busyRoom[i] = R.busyRoom[i]; 37 | } 38 | } 39 | 40 | Room& Room::operator=(const Room& R) 41 | { 42 | if(this != &R) 43 | { 44 | this->numberRooms = R.numberRooms; 45 | for(int i = 1; i <= 365; i++) 46 | { 47 | busyRoom[i] = R.busyRoom[i]; 48 | } 49 | } 50 | return *this; 51 | } 52 | 53 | Room::~Room() 54 | { 55 | this->numberRooms--; 56 | this->busyRoom.clear(); 57 | } 58 | 59 | void Room::setBusyRoom(int day, bool status) 60 | { 61 | if(day > 0 && day < 366) 62 | { 63 | busyRoom[day] = status; 64 | } 65 | } 66 | 67 | bool Room::getBusyRoom(int day) 68 | { 69 | return busyRoom[day]; 70 | } -------------------------------------------------------------------------------- /Hotel Booking System/quadruble_room.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "room.h" 3 | 4 | class QuadrubleRoom: public Room 5 | { 6 | private: 7 | const static int numberBeds = 4; 8 | int price; 9 | public: 10 | QuadrubleRoom(int = 0); 11 | QuadrubleRoom(const QuadrubleRoom&); 12 | QuadrubleRoom& operator=(const QuadrubleRoom&); 13 | ~QuadrubleRoom(); 14 | 15 | int getCapacity(); 16 | 17 | virtual std::string type() const; 18 | virtual void readData(std::istream&); 19 | virtual void writeData(std::ostream&); 20 | }; 21 | 22 | QuadrubleRoom::QuadrubleRoom(int price_p) : Room(), price(price_p) {} 23 | 24 | QuadrubleRoom::QuadrubleRoom(const QuadrubleRoom& QR) : Room(QR), price(QR.price) {} 25 | 26 | QuadrubleRoom& QuadrubleRoom::operator=(const QuadrubleRoom& QR) 27 | { 28 | this->Room::operator=(QR); 29 | this->price = QR.price; 30 | return *this; 31 | } 32 | 33 | QuadrubleRoom::~QuadrubleRoom() 34 | { 35 | this->price = 0; 36 | } 37 | 38 | std::string QuadrubleRoom::type() const 39 | { 40 | return "QuadrubleRoom"; 41 | } 42 | 43 | void QuadrubleRoom::readData(std::istream& input) 44 | { 45 | std::cout << "\nEnter the price of a quadruble room.\n"; 46 | input >> price; 47 | } 48 | 49 | void QuadrubleRoom::writeData(std::ostream& output) 50 | { 51 | output << "\nThe price of a quadruble room is " << price << ".\n"; 52 | } 53 | 54 | int QuadrubleRoom::getCapacity() 55 | { 56 | return numberBeds; 57 | } -------------------------------------------------------------------------------- /Colocviu 2014/adultsub40.cpp: -------------------------------------------------------------------------------- 1 | #include "adultsub40.h" 2 | #include 3 | 4 | Adultsub40::Adultsub40(std::string nume, std::string prenume, int varsta, double colesterol, double tensiuneArteriala, std::string datacolesterol, std::string datatensiune): Pacient(nume, prenume, varsta, colesterol, tensiuneArteriala, datacolesterol, datatensiune){} 5 | 6 | Adultsub40::Adultsub40(const Adultsub40 & A): Pacient(A){} 7 | 8 | Adultsub40& Adultsub40::operator=(const Adultsub40& A){ 9 | if(&A == this) return *this; 10 | Pacient::operator=(A); 11 | return *this; 12 | } 13 | Adultsub40::~Adultsub40(){ 14 | 15 | } 16 | 17 | 18 | void Adultsub40::citire(){ 19 | std::cin >> nume; 20 | std::cin >> prenume; 21 | std::cin >> varsta; 22 | std::cin >> colesterol; 23 | std::cin >> tensiuneArteriala; 24 | std::cin >> datacolesterol; 25 | std::cin >> datatensiune; 26 | } 27 | 28 | void Adultsub40::afisare(){ 29 | std::cout << this->nume << " " << this->prenume << ": Risc cardiovascular: " << this->gradRiscCardiovascular() << "; Colesterol: (" << this->datacolesterol << "): "; 30 | std::cout << this->colesterol << "mg/dl; TA: (" << this->datatensiune << "): " << this->tensiuneArteriala << ".\n"; 31 | } 32 | 33 | std::string Adultsub40::gradRiscCardiovascular(){ 34 | int simptome = 0; 35 | if(this->colesterol > 240) simptome++; 36 | if(this->tensiuneArteriala > 139) simptome++; 37 | 38 | if(simptome >= 1) return "DA"; 39 | return "NU"; 40 | } 41 | 42 | std::string Adultsub40::getType(){ 43 | return "Adultsub40"; 44 | } -------------------------------------------------------------------------------- /Colocviu 2014/pacient.cpp: -------------------------------------------------------------------------------- 1 | #include "pacient.h" 2 | 3 | int Pacient::contor = 0; 4 | 5 | Pacient::Pacient(std::string nume, std::string prenume, int varsta, double colesterol, double tensiuneArteriala, std::string datacolesterol, std::string datatensiune){ 6 | this->nume = nume; 7 | this->prenume = prenume; 8 | this->varsta = varsta; 9 | this->colesterol = colesterol; 10 | this->tensiuneArteriala = tensiuneArteriala; 11 | this->datacolesterol = datacolesterol; 12 | this->datatensiune = datatensiune; 13 | contor++; 14 | this->id = contor; 15 | } 16 | 17 | Pacient::Pacient(const Pacient &P){ 18 | this->nume = P.nume; 19 | this->prenume = P.prenume; 20 | this->varsta = P.varsta; 21 | this->colesterol = P.colesterol; 22 | this->tensiuneArteriala = P.tensiuneArteriala; 23 | this->datacolesterol = P.datacolesterol; 24 | this->datatensiune = P.datatensiune; 25 | } 26 | 27 | 28 | Pacient& Pacient::operator=(const Pacient &P){ 29 | if (this == &P) return *this; 30 | this->nume = nume; 31 | this->prenume = prenume; 32 | this->varsta = varsta; 33 | this->colesterol = colesterol; 34 | this->tensiuneArteriala = tensiuneArteriala; 35 | this->datacolesterol = P.datacolesterol; 36 | this->datatensiune = P.datatensiune; 37 | return *this; 38 | } 39 | 40 | Pacient::~Pacient(){ 41 | this->nume.clear(); 42 | this->prenume.clear(); 43 | this->datacolesterol.clear(); 44 | this->datatensiune.clear(); 45 | } 46 | 47 | int Pacient::getId() const{ 48 | return this->id; 49 | } 50 | 51 | std::string Pacient::getNume() const{ 52 | return this->nume; 53 | } -------------------------------------------------------------------------------- /Hotel Booking System/restaurant.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "room.h" 3 | 4 | class Restaurant: public Room 5 | { 6 | private: 7 | int priceBreakfast; 8 | int capacity; 9 | public: 10 | Restaurant(int = 0, int = 0); 11 | Restaurant(const Restaurant&); 12 | Restaurant& operator=(const Restaurant&); 13 | ~Restaurant(); 14 | 15 | int getCapacity(); 16 | 17 | virtual std::string type() const; 18 | virtual void readData(std::istream&); 19 | virtual void writeData(std::ostream&); 20 | }; 21 | 22 | Restaurant::Restaurant(int priceBreakfast_p, int capacity_p): Room() 23 | { 24 | this->priceBreakfast = priceBreakfast_p; 25 | this->capacity = capacity_p; 26 | } 27 | 28 | Restaurant::Restaurant(const Restaurant& R) : Room(R) 29 | { 30 | this->priceBreakfast = R.priceBreakfast; 31 | this->capacity = R.capacity; 32 | } 33 | 34 | Restaurant& Restaurant::operator=(const Restaurant &R) 35 | { 36 | if(this != &R) 37 | { 38 | this->Room::operator=(R); 39 | this->priceBreakfast = R.priceBreakfast; 40 | this->capacity = R.capacity; 41 | } 42 | return *this; 43 | } 44 | 45 | Restaurant::~Restaurant() 46 | { 47 | this->priceBreakfast = 0; 48 | this->capacity = 0; 49 | } 50 | 51 | std::string Restaurant::type() const 52 | { 53 | return "Restaurant"; 54 | } 55 | 56 | void Restaurant::readData(std::istream& input) 57 | { 58 | std::cout << "\nEnter the capacity of the restaurant.\n"; 59 | input >> capacity; 60 | std::cout << "\nEnter the price for breakfast.\n"; 61 | input >> priceBreakfast; 62 | } 63 | 64 | void Restaurant::writeData(std::ostream& output) 65 | { 66 | output << "\nThe capacity of the restaurant is " << capacity << ".\n"; 67 | output << "\nThe price of the breakfast is " << priceBreakfast << ".\n"; 68 | } 69 | 70 | int Restaurant::getCapacity() 71 | { 72 | return capacity; 73 | } -------------------------------------------------------------------------------- /Colocviu 2014/adultpeste40.cpp: -------------------------------------------------------------------------------- 1 | #include "adultpeste40.h" 2 | #include 3 | 4 | Adultpeste40::Adultpeste40(std::string nume, std::string prenume, int varsta, double colesterol, double tensiuneArteriala, std::string datacolesterol, std::string datatensiune, std::string fumator, std::string sedentarism): Pacient(nume, prenume, varsta, colesterol, tensiuneArteriala, datacolesterol, datatensiune){ 5 | this->fumator = fumator; 6 | this->sedentarism = sedentarism; 7 | } 8 | 9 | Adultpeste40::Adultpeste40(const Adultpeste40 & A): Pacient(A){ 10 | this->fumator = A.fumator; 11 | this->sedentarism = A.sedentarism; 12 | } 13 | 14 | Adultpeste40& Adultpeste40::operator=(const Adultpeste40& A){ 15 | if(&A == this) return *this; 16 | Pacient::operator=(A); 17 | this->fumator = A.fumator; 18 | this->sedentarism = A.sedentarism; 19 | return *this; 20 | } 21 | Adultpeste40::~Adultpeste40(){ 22 | 23 | } 24 | 25 | 26 | void Adultpeste40::citire(){ 27 | std::cin >> nume; 28 | std::cin >> prenume; 29 | std::cin >> varsta; 30 | std::cin >> colesterol; 31 | std::cin >> tensiuneArteriala; 32 | std::cin >> datacolesterol; 33 | std::cin >> datatensiune; 34 | std::cin >> fumator; 35 | std::cin >> sedentarism; 36 | } 37 | 38 | void Adultpeste40::afisare(){ 39 | std::cout << this->nume << " " << this->prenume << ": Risc cardiovascular: " << this->gradRiscCardiovascular() << "; Colesterol: (" << this->datacolesterol << "): "; 40 | std::cout << this->colesterol << "mg/dl; TA: (" << this->datatensiune << "): " << this->tensiuneArteriala << ".\n"; 41 | std::cout << "Fumator: " << this->fumator << "; sedentarism: " << this->sedentarism << "\n"; 42 | } 43 | 44 | std::string Adultpeste40::gradRiscCardiovascular(){ 45 | int simptome = 0; 46 | if(this->colesterol > 240 or this->tensiuneArteriala > 139) simptome++; 47 | 48 | if(this->fumator == "da" and this->sedentarism == "ridicat") simptome++; 49 | 50 | if(simptome == 2) return "RIDICAT"; 51 | if(simptome == 1) return "DA"; 52 | return "NU"; 53 | } 54 | 55 | std::string Adultpeste40::getType(){ 56 | return "Adultpeste40"; 57 | } -------------------------------------------------------------------------------- /Hotel Booking System/individual_c_room.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stage_room.h" 3 | #include 4 | #include 5 | 6 | class IndividualConferenceRoom: public StageConferenceRoom 7 | { 8 | private: 9 | std::vector tables; 10 | public: 11 | IndividualConferenceRoom(bool = 0, int = 0, int = 0); 12 | IndividualConferenceRoom(const IndividualConferenceRoom&); 13 | IndividualConferenceRoom& operator=(const IndividualConferenceRoom&); 14 | ~IndividualConferenceRoom(); 15 | 16 | virtual std::string type() const; 17 | virtual void readData(std::istream&); 18 | virtual void writeData(std::ostream&); 19 | }; 20 | 21 | IndividualConferenceRoom::IndividualConferenceRoom(bool hasVideoProjector_p, int capacity_p, int price_p): StageConferenceRoom(hasVideoProjector_p, capacity_p, price_p) {} 22 | 23 | IndividualConferenceRoom::IndividualConferenceRoom(const IndividualConferenceRoom& ICR) : StageConferenceRoom(ICR) 24 | { 25 | this->tables = ICR.tables; 26 | } 27 | 28 | IndividualConferenceRoom& IndividualConferenceRoom::operator=(const IndividualConferenceRoom& ICR) 29 | { 30 | if(this != &ICR) 31 | { 32 | this->StageConferenceRoom::operator=(ICR); 33 | this->tables.clear(); 34 | this->tables = ICR.tables; 35 | } 36 | return *this; 37 | } 38 | 39 | IndividualConferenceRoom::~IndividualConferenceRoom() 40 | { 41 | this->tables.clear(); 42 | } 43 | 44 | std::string IndividualConferenceRoom::type() const 45 | { 46 | return "IndividualConferenceRoom"; 47 | } 48 | 49 | void IndividualConferenceRoom::readData(std::istream& input) 50 | { 51 | this->StageConferenceRoom::readData(input); 52 | 53 | std::cout << "\nEnter the number of tables\n"; 54 | int number; 55 | input >> number; 56 | 57 | std::cout << "\nEnter the capacity of each table.\n"; 58 | this->tables.clear(); 59 | for(int i = 0; i < number; ++i) 60 | { 61 | int x; 62 | input >> x; 63 | if(x < 4 || x > 8) 64 | { 65 | throw std::invalid_argument("Error!"); 66 | } 67 | tables.push_back(x); 68 | } 69 | } 70 | 71 | void IndividualConferenceRoom::writeData(std::ostream& output) 72 | { 73 | this->StageConferenceRoom::writeData(output); 74 | 75 | output << "\nThe number of tables is " << tables.size() << ".\n"; 76 | output << "\nThe capacity of each tables:\n"; 77 | for(unsigned int i = 0; i < tables.size(); ++i) 78 | { 79 | output << "Table " << i+1 << ": " << tables[i] << ".\n"; 80 | } 81 | } -------------------------------------------------------------------------------- /Colocviu 2014/copil.cpp: -------------------------------------------------------------------------------- 1 | #include "copil.h" 2 | #include 3 | 4 | Copil::Copil(std::string nume, std::string prenume, int varsta, double colesterol, double tensiuneArteriala, std::string datacolesterol, std::string datatensiune, std::string antecedentefamilie, std::string numeMama, std::string numeTata, std::string dataProteinaC, double proteinaC): Pacient(nume, prenume, varsta, colesterol, tensiuneArteriala, datacolesterol, datatensiune){ 5 | this->antecedentefamilie = antecedentefamilie; 6 | this->numeMama = numeMama; 7 | this->numeTata = numeTata; 8 | this->dataProteinaC = dataProteinaC; 9 | this->proteinaC = proteinaC; 10 | } 11 | 12 | Copil::Copil(const Copil& A): Pacient(A){ 13 | this->antecedentefamilie = A.antecedentefamilie; 14 | this->numeMama = A.numeMama; 15 | this->numeTata = A.numeTata; 16 | this->dataProteinaC = A.dataProteinaC; 17 | this->proteinaC = A.proteinaC; 18 | } 19 | 20 | Copil& Copil::operator=(const Copil& A){ 21 | if(&A == this) return *this; 22 | Pacient::operator=(A); 23 | this->antecedentefamilie = A.antecedentefamilie; 24 | this->numeMama = A.numeMama; 25 | this->numeTata = A.numeTata; 26 | this->dataProteinaC = A.dataProteinaC; 27 | this->proteinaC = A.proteinaC; 28 | return *this; 29 | } 30 | Copil::~Copil(){ 31 | 32 | } 33 | 34 | 35 | void Copil::citire(){ 36 | std::cin >> nume; 37 | std::cin >> prenume; 38 | std::cin >> varsta; 39 | std::cin >> colesterol; 40 | std::cin >> tensiuneArteriala; 41 | std::cin >> datacolesterol; 42 | std::cin >> datatensiune; 43 | std::cin >> antecedentefamilie; 44 | std::cin >> numeMama; 45 | std::cin >> numeTata; 46 | std::cin >> dataProteinaC; 47 | std::cin >> proteinaC; 48 | } 49 | 50 | void Copil::afisare(){ 51 | std::cout << this->nume << " " << this->prenume << ": Risc cardiovascular: " << this->gradRiscCardiovascular() << "; Colesterol: (" << this->datacolesterol << "): "; 52 | std::cout << this->colesterol << "mg/dl; TA: (" << this->datatensiune << "): " << this->tensiuneArteriala << ".\n"; 53 | std::cout << "Proteina C reactiva: " << this->proteinaC << " mg/dl; Antecedente familie: " << this->antecedentefamilie; 54 | } 55 | 56 | std::string Copil::gradRiscCardiovascular(){ 57 | int simptome = 0; 58 | if(this->colesterol > 240 or this->tensiuneArteriala > 139) simptome++; 59 | if(this->antecedentefamilie == "da") simptome++; 60 | 61 | if(simptome == 2) return "RIDICAT"; 62 | if(simptome == 1) return "DA"; 63 | return "NU"; 64 | } 65 | 66 | std::string Copil::getType(){ 67 | return "Copil"; 68 | } -------------------------------------------------------------------------------- /Hotel Booking System/stage_room.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "room.h" 3 | 4 | class StageConferenceRoom: public Room 5 | { 6 | protected: 7 | bool hasVideoProjector; 8 | int capacity; 9 | int price; 10 | public: 11 | StageConferenceRoom(bool = 0, int = 0, int = 0); 12 | StageConferenceRoom(const StageConferenceRoom&); 13 | StageConferenceRoom& operator=(const StageConferenceRoom&); 14 | virtual ~StageConferenceRoom(); 15 | 16 | int getCapacity(); 17 | 18 | virtual std::string type() const; 19 | virtual void readData(std::istream&); 20 | virtual void writeData(std::ostream&); 21 | }; 22 | 23 | StageConferenceRoom::StageConferenceRoom(bool hasVideoProjector_p, int capacity_p, int price_p): Room(), price(price_p) 24 | { 25 | this->hasVideoProjector = hasVideoProjector_p; 26 | this->capacity = capacity_p; 27 | } 28 | 29 | StageConferenceRoom::StageConferenceRoom(const StageConferenceRoom& SCR) : Room(SCR) 30 | { 31 | this->hasVideoProjector = SCR.hasVideoProjector; 32 | this->capacity = SCR.capacity; 33 | this->price = SCR.price; 34 | } 35 | 36 | StageConferenceRoom& StageConferenceRoom::operator=(const StageConferenceRoom& SCR) 37 | { 38 | this->Room::operator=(SCR); 39 | this->price = SCR.price; 40 | this->hasVideoProjector = SCR.hasVideoProjector; 41 | this->capacity = SCR.capacity; 42 | return *this; 43 | } 44 | 45 | StageConferenceRoom::~StageConferenceRoom() 46 | { 47 | this->price = 0; 48 | this->hasVideoProjector = 0; 49 | this->capacity = 0; 50 | } 51 | 52 | std::string StageConferenceRoom::type() const 53 | { 54 | return "StageConferenceRoom"; 55 | } 56 | 57 | void StageConferenceRoom::readData(std::istream& input) 58 | { 59 | std::cout << "\nEnter the capacity of the conference room.\n"; 60 | input >> capacity; 61 | 62 | std::cout << "\nEnter the price of a conference room.\n"; 63 | input >> price; 64 | 65 | std::cout << "\nEnter 1 if the conference room has a video projector or 0 otherwise.\n"; 66 | int choice; 67 | input >> choice; 68 | if(choice != 0 && choice != 1) 69 | { 70 | std:: cout << "\nSorry, this option doesn't exist. By default, the conference room will not have a video projector.\n"; 71 | this->hasVideoProjector = 0; 72 | } 73 | else 74 | { 75 | this->hasVideoProjector = choice; 76 | } 77 | } 78 | 79 | void StageConferenceRoom::writeData(std::ostream& output) 80 | { 81 | output << "\nThe capacity of the conference room is " << capacity << ".\n"; 82 | output << "\nThe price of the conference room is " << price << ".\n"; 83 | if(hasVideoProjector == 0) 84 | { 85 | output << "\nThe conference room doesn't have any video projector.\n"; 86 | } 87 | else 88 | { 89 | output << "\nThe conference room has a video projector.\n"; 90 | } 91 | } 92 | 93 | int StageConferenceRoom::getCapacity() 94 | { 95 | return capacity; 96 | } -------------------------------------------------------------------------------- /Hotel Booking System/person.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | class Person 5 | { 6 | private: 7 | std::string firstName; 8 | std::string lastName; 9 | int age; 10 | bool hasBreakfast; 11 | public: 12 | Person(std::string = "", std::string = "", int = -1, bool = 0); 13 | Person(const Person&); 14 | Person& operator=(const Person&); 15 | ~Person(); 16 | 17 | bool getBreakfast(); 18 | 19 | friend std::istream& operator>>(std::istream&, Person&); 20 | friend std::ostream& operator<<(std::ostream&, const Person&); 21 | }; 22 | 23 | Person::Person(std::string firstName_p,std::string lastName_p,int age_p,bool hasBreakfast_p) 24 | { 25 | this->firstName = firstName_p; 26 | this->lastName = lastName_p; 27 | this->age = age_p; 28 | this->hasBreakfast = hasBreakfast_p; 29 | } 30 | 31 | Person::Person(const Person &P) 32 | { 33 | this->firstName = P.firstName; 34 | this->lastName = P.lastName; 35 | this->age = P.age; 36 | this->hasBreakfast = P.hasBreakfast; 37 | } 38 | 39 | Person& Person::operator=(const Person &P) 40 | { 41 | if(this != &P) 42 | { 43 | this->firstName = firstName; 44 | this->lastName = lastName; 45 | this->age = age; 46 | this->hasBreakfast = hasBreakfast; 47 | } 48 | return *this; 49 | } 50 | 51 | Person::~Person() 52 | { 53 | this->firstName = ""; 54 | this->lastName = ""; 55 | this->age = -1; 56 | this->hasBreakfast = 0; 57 | } 58 | 59 | std::istream& operator>>(std::istream& input, Person& P) 60 | { 61 | std::cout << "\nEnter the first name.\n"; 62 | sleep(1); 63 | input >> P.firstName; 64 | std::cout << "\nEnter the last name.\n"; 65 | sleep(1); 66 | input >> P.lastName; 67 | std::cout << "\nEnter the age.\n"; 68 | sleep(1); 69 | input >> P.age; 70 | if(P.age < 0) 71 | { 72 | std::cout << "\nSorry, a person has to be at least one year old. By default, this person is 0 year old.\n"; 73 | sleep(1); 74 | } 75 | std::cout << "\nEnter 1 if the person wants to have breakfast at restaurant or 0 if the person wants to have breakfast in the hotel room.\n"; 76 | sleep(1); 77 | int choice; 78 | input >> choice; 79 | if(choice != 0 && choice != 1) 80 | { 81 | std::cout << "\nSorry, this option doesn't exist. By default " << P.firstName << " " << P.lastName << " will have breakfast in the hotel room.\n"; 82 | sleep(1); 83 | } 84 | else 85 | { 86 | P.hasBreakfast = choice; 87 | } 88 | return input; 89 | } 90 | 91 | std::ostream& operator<<(std::ostream& output,const Person& P) 92 | { 93 | output << "\nDetails about the person.\n"; 94 | output << "\nThe person called " << P.firstName << " " << P.lastName << " is " << P.age << " years old "; 95 | if(P.hasBreakfast) 96 | { 97 | output << "and wants to have breakfast at restaurant during the trip.\n"; 98 | } 99 | else 100 | { 101 | output << "and wants to have breakfast in the hotel room during the trip.\n"; 102 | } 103 | return output; 104 | } 105 | 106 | bool Person::getBreakfast() 107 | { 108 | return hasBreakfast; 109 | } -------------------------------------------------------------------------------- /Stack/node.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | template 5 | class Node 6 | { 7 | private: 8 | T data; 9 | Node *next; 10 | public: 11 | Node(); 12 | Node(T); 13 | Node(const Node &); 14 | Node& operator=(const Node&); 15 | ~Node(); 16 | T get_data(); 17 | Node* get_next(); 18 | void set_data(T); 19 | void set_next(Node*); 20 | bool operator==(const Node&) const; 21 | bool operator>(const Node&) const; 22 | bool operator>=(const Node&) const; 23 | bool operator<(const Node&) const; 24 | bool operator<=(const Node&) const; 25 | bool operator!=(const Node&) const; 26 | template 27 | friend std::istream& operator >>(std::istream&, Node&); 28 | template 29 | friend std::ostream& operator <<(std::ostream&, const Node&); 30 | templatefriend class Stack; 31 | }; 32 | 33 | //IMPLEMENTATION 34 | 35 | 36 | 37 | //--constructors 38 | 39 | template 40 | Node::Node() 41 | { 42 | this->next = NULL; 43 | } 44 | 45 | template 46 | Node::Node(T value) 47 | { 48 | this->data = value; 49 | this->next = NULL; 50 | } 51 | 52 | //--copy-constructor 53 | template 54 | Node::Node(const Node& N) 55 | { 56 | this->data = N.data; 57 | this->next = N.next; 58 | } 59 | 60 | 61 | template 62 | Node& Node::operator=(const Node&N) 63 | { 64 | if(this != &N) 65 | { 66 | this->data = N.data; 67 | this->next = N.next; 68 | } 69 | return *this; 70 | } 71 | 72 | //--destructor 73 | template 74 | Node::~Node() 75 | { 76 | this->next = NULL; 77 | } 78 | 79 | 80 | 81 | template 82 | T Node::get_data() 83 | { 84 | return this->data; 85 | } 86 | 87 | template 88 | Node* Node::get_next() 89 | { 90 | return this->next; 91 | } 92 | 93 | template 94 | void Node::set_data(T value) 95 | { 96 | this->data = value; 97 | } 98 | 99 | template 100 | void Node::set_next(Node* n) 101 | { 102 | this->next = n; 103 | } 104 | 105 | 106 | 107 | template 108 | bool Node::operator==(const Node& N) const 109 | { 110 | return (this->data == N.data); 111 | } 112 | 113 | template 114 | bool Node::operator>(const Node& N) const 115 | { 116 | return (this->data > N.data); 117 | } 118 | 119 | template 120 | bool Node::operator>=(const Node& N) const 121 | { 122 | return (*this > N) || (*this == N); 123 | } 124 | 125 | template 126 | bool Node::operator<(const Node& N) const 127 | { 128 | return !(*this >= N); 129 | } 130 | 131 | template 132 | bool Node::operator<=(const Node& N) const 133 | { 134 | return !(*this > N); 135 | } 136 | 137 | template 138 | bool Node::operator!=(const Node& N) const 139 | { 140 | return !(*this == N); 141 | } 142 | 143 | template 144 | std::istream& operator>>(std::istream& i, Node& N) 145 | { 146 | i >> N.data; 147 | N.next = NULL; 148 | return i; 149 | } 150 | 151 | template 152 | std::ostream& operator<<(std::ostream& o, const Node& N) 153 | { 154 | o << N.data; 155 | return o; 156 | } -------------------------------------------------------------------------------- /Colocviu 2014/cabinet.cpp: -------------------------------------------------------------------------------- 1 | #include "cabinet.h" 2 | #include "pacient.h" 3 | #include "copil.h" 4 | #include "adultsub40.h" 5 | #include "adultpeste40.h" 6 | #include 7 | #include 8 | 9 | Cabinet* Cabinet::instance = nullptr; 10 | 11 | Cabinet::Cabinet(std::string numeDoctor, std::string adresa): numeDoctor(numeDoctor), adresa(adresa){} 12 | 13 | Cabinet* Cabinet::getInstance(std::string numeDoctor, std::string adresa){ 14 | if(instance == nullptr){ 15 | instance = new Cabinet(numeDoctor, adresa); 16 | } 17 | return instance; 18 | } 19 | 20 | 21 | std::string Cabinet::getNumeDoctor(){ 22 | return this->numeDoctor; 23 | } 24 | void Cabinet::setNumeDoctor(std::string numeDoctor){ 25 | this->numeDoctor = numeDoctor; 26 | } 27 | std::string Cabinet::getAdresa(){ 28 | return this->adresa; 29 | } 30 | void Cabinet::setAdresa(std::string adresa){ 31 | this->adresa = adresa; 32 | } 33 | 34 | void Cabinet::mesaj(){ 35 | std::cout << "Adresa: " << this->adresa << "\n"; 36 | std::cout << "Doctor: " << this->numeDoctor << "\n"; 37 | std::cout << "Meniu:\n"; 38 | std::cout << "1.Afiseaza toti pacientii.\n"; 39 | std::cout << "2.Afiseaza pacientii adulti cu factor de risc cardiovascular ridicat.\n"; 40 | std::cout << "3.Afiseaza pacientii copii cu factor de risc cardiovascular.\n"; 41 | std::cout << "4.Afiseaza pacientii al caror nume de familie este cel dat de la tastatura.\n"; 42 | std::cout << "5.Adauga pacient\n"; 43 | std::cout << "6.Iesire\n"; 44 | } 45 | 46 | void Cabinet::afiseazaCopiiRisc(){ 47 | std::cout << "Copii:\n"; 48 | for(unsigned int i = 0; i < pacienti.size(); i++){ 49 | if(pacienti[i]->getType() == "Copil" and (pacienti[i]->gradRiscCardiovascular() == "RIDICAT" or pacienti[i]->gradRiscCardiovascular() == "DA")){ 50 | this->afiseazaPacient(i); 51 | } 52 | } 53 | } 54 | 55 | void Cabinet::afiseazaPacientiNume(std::string nume){ 56 | for(unsigned int i = 0; i < pacienti.size(); i++){ 57 | if(pacienti[i]->getType() == "Adultsub40" and pacienti[i]->getNume() == nume){ 58 | this->afiseazaPacient(i); 59 | } 60 | } 61 | std::cout << "Adulti peste 40 ani:\n"; 62 | for(unsigned int i = 0; i < pacienti.size(); i++){ 63 | if(pacienti[i]->getType() == "Adultpeste40" and pacienti[i]->getNume() == nume){ 64 | this->afiseazaPacient(i); 65 | } 66 | } 67 | std::cout << "Copii:\n"; 68 | for(unsigned int i = 0; i < pacienti.size(); i++){ 69 | if(pacienti[i]->getType() == "Copil" and pacienti[i]->getNume() == nume){ 70 | this->afiseazaPacient(i); 71 | } 72 | } 73 | } 74 | 75 | void Cabinet::afiseazaAdultiRiscRidicat(){ 76 | std::cout << "Adulti peste 40 ani:\n"; 77 | for(unsigned int i = 0; i < pacienti.size(); i++){ 78 | if(pacienti[i]->getType() == "Adultpeste40" and pacienti[i]->gradRiscCardiovascular() == "RIDICAT"){ 79 | this->afiseazaPacient(i); 80 | } 81 | } 82 | } 83 | 84 | void Cabinet::adaugaPacient(std::string tip){ 85 | Pacient *p; 86 | if(tip == "adultsub40"){ 87 | p = new Adultsub40(); 88 | } 89 | if(tip == "adultpeste40"){ 90 | p = new Adultpeste40(); 91 | } 92 | if(tip == "copil"){ 93 | p = new Copil(); 94 | } 95 | p->citire(); 96 | pacienti.push_back(p); 97 | } 98 | 99 | void Cabinet::afiseazaPacient(int i){ 100 | std::cout << "Id: " << pacienti[i]->getId() << "\n"; 101 | pacienti[i]->afisare(); 102 | std::cout << "\n"; 103 | } 104 | 105 | void Cabinet::afiseazaPacienti(){ 106 | std::cout << "Adulti sub 40 ani:\n"; 107 | for(unsigned int i = 0; i < pacienti.size(); i++){ 108 | if(pacienti[i]->getType() == "Adultsub40"){ 109 | this->afiseazaPacient(i); 110 | } 111 | } 112 | std::cout << "Adulti peste 40 ani:\n"; 113 | for(unsigned int i = 0; i < pacienti.size(); i++){ 114 | if(pacienti[i]->getType() == "Adultpeste40"){ 115 | this->afiseazaPacient(i); 116 | } 117 | } 118 | std::cout << "Copii:\n"; 119 | for(unsigned int i = 0; i < pacienti.size(); i++){ 120 | if(pacienti[i]->getType() == "Copil"){ 121 | this->afiseazaPacient(i); 122 | } 123 | } 124 | } -------------------------------------------------------------------------------- /Hotel Booking System/group.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "person.h" 3 | #include 4 | #include 5 | 6 | 7 | class Group 8 | { 9 | private: 10 | std::vector people; 11 | int period; 12 | int typeConferenceRoom; 13 | public: 14 | Group(int = 0, int = 0); 15 | Group(const Group&); 16 | Group& operator=(const Group&); 17 | ~Group(); 18 | 19 | int getNumberPeople(); 20 | int getNumberPeopleBreakfast(); 21 | int getConferenceRoom(); 22 | int getPeriod(); 23 | 24 | friend std::istream& operator>>(std::istream&, Group&); 25 | friend std::ostream& operator<<(std::ostream&, const Group&); 26 | friend class Hotel; 27 | }; 28 | 29 | 30 | 31 | Group::Group(int period_p, int typeConferenceRoom_p) 32 | { 33 | this->period = period_p; 34 | this->typeConferenceRoom = typeConferenceRoom_p; 35 | } 36 | 37 | Group::Group(const Group& G) 38 | { 39 | this->people = G.people; 40 | this->period = G.period; 41 | this->typeConferenceRoom = G.typeConferenceRoom; 42 | } 43 | 44 | Group& Group::operator=(const Group& G) 45 | { 46 | if(this != &G) 47 | { 48 | this->people = G.people; 49 | this->period = G.period; 50 | this->typeConferenceRoom = G.typeConferenceRoom; 51 | } 52 | 53 | return *this; 54 | } 55 | 56 | Group::~Group() 57 | { 58 | this->people.clear(); 59 | this->period = 0; 60 | this->typeConferenceRoom = 0; 61 | } 62 | 63 | std::istream& operator>>(std::istream& input, Group& G) 64 | { 65 | std::cout << "\nEnter the booking period of the group.\n"; 66 | sleep(1); 67 | input >> G.period; 68 | std::cout << "\nEnter 1 if the group wants to book a conference room or 0 otherwise.\n"; 69 | sleep(1); 70 | int choice1; 71 | input >> choice1; 72 | if(choice1 != 1 && choice1 != 0) 73 | { 74 | std::cout << "\nSorry, this option doesn't exist. By default this group will not book a conference room.\n"; 75 | sleep(1); 76 | G.typeConferenceRoom = 0; 77 | } 78 | else 79 | { 80 | if(!choice1) 81 | { 82 | G.typeConferenceRoom = 0; 83 | } 84 | else 85 | { 86 | std::cout << "\nEnter 1 if the group wants the conference room to be stage or \n0 if the group wants the conference room to be individual.\n"; 87 | sleep(1); 88 | int choice2; 89 | input >> choice2; 90 | if(choice2 != 1 && choice2 != 0) 91 | { 92 | std::cout << "\nSorry, this option doesn't exist. By default this group will not book a conference room.\n"; 93 | sleep(1); 94 | G.typeConferenceRoom = 0; 95 | } 96 | else 97 | { 98 | G.typeConferenceRoom = choice2; 99 | } 100 | } 101 | } 102 | 103 | std::cout << "\nEnter the number of people of the group.\n"; 104 | sleep(1); 105 | int number; 106 | input >> number; 107 | if(number < 0) 108 | { 109 | std::cout << "\nSorry, it is impossible not to have a group with at least one person. By default, the number of people of the group is 0.\n"; 110 | return input; 111 | } 112 | 113 | std::cout << "\nEnter the people of the group.\n"; 114 | sleep(1); 115 | for(int i = 0; i < number; ++i) 116 | { 117 | std::cout << "Person number " << i+1 << ":\n"; 118 | Person P; 119 | input >> P; 120 | G.people.push_back(P); 121 | } 122 | return input; 123 | } 124 | 125 | std::ostream& operator<<(std::ostream& output, const Group& G) 126 | { 127 | output << "\nDetails about the group.\n"; 128 | output << "\nThe booking period of the group is of " << G.period << " days."; 129 | 130 | switch(G.typeConferenceRoom) 131 | { 132 | case 0: 133 | output << "\nThe group doesn't want a conference room."; 134 | break; 135 | case 1: 136 | output << "\nThe group wants a conference room(stage)."; 137 | break; 138 | case 2: 139 | output << "\nThe group wants a conference room(individual)."; 140 | break; 141 | } 142 | 143 | output << "\nThe number of people of the group is " << G.people.size() << ".\n"; 144 | output << "\nThe people of the group are:\n"; 145 | for(unsigned int i = 0; i < G.people.size(); ++i) 146 | { 147 | output << "Person number " << i+1 << ":\n"; 148 | output << G.people[i] << "\n"; 149 | } 150 | 151 | return output; 152 | } 153 | 154 | int Group::getNumberPeople() 155 | { 156 | return people.size(); 157 | } 158 | int Group::getNumberPeopleBreakfast() 159 | { 160 | int cnt = 0; 161 | for(unsigned int i = 0; i < people.size(); i++) 162 | { 163 | cnt += people[i].getBreakfast(); 164 | } 165 | return cnt; 166 | } 167 | 168 | int Group::getConferenceRoom() 169 | { 170 | return typeConferenceRoom; 171 | } 172 | 173 | int Group::getPeriod() 174 | { 175 | return period; 176 | } -------------------------------------------------------------------------------- /Stack/stack.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "node.h" 3 | 4 | 5 | template 6 | class Stack 7 | { 8 | private: 9 | Node* head; 10 | int dimension; 11 | public: 12 | Stack(); 13 | Stack(const Stack&); 14 | Stack& operator=(const Stack&); 15 | ~Stack(); 16 | void push(U); 17 | void pop(); 18 | void clear(); 19 | U top(); 20 | bool empty(); 21 | int size(); 22 | bool operator==(const Stack&) const; 23 | bool operator>(const Stack&) const; 24 | bool operator>=(const Stack&) const; 25 | bool operator<(const Stack&) const; 26 | bool operator<=(const Stack&) const; 27 | bool operator!=(const Stack&) const; 28 | template 29 | friend std::istream& operator>>(std::istream&, Stack&); 30 | template 31 | friend std::ostream& operator<<(std::ostream&, Stack&); 32 | }; 33 | 34 | //IMPLEMENTATION 35 | 36 | 37 | //--constructor 38 | template 39 | Stack::Stack() 40 | { 41 | this->head = NULL; 42 | this->dimension = 0; 43 | } 44 | 45 | //--specific methods of stack 46 | 47 | template 48 | void Stack::push(T value) 49 | { 50 | Node *temp = new Node(value); 51 | ++dimension; 52 | 53 | if(head == NULL) 54 | { 55 | head = temp; 56 | } 57 | else 58 | { 59 | temp->set_next(head); 60 | head = temp; 61 | } 62 | } 63 | 64 | template 65 | void Stack::pop() 66 | { 67 | if(head == NULL) 68 | { 69 | std::cout << "\nStack is empty already.\n"; 70 | return; 71 | } 72 | 73 | Node *temp = head; 74 | if(head->next == NULL) 75 | { 76 | head = NULL; 77 | } 78 | else 79 | { 80 | head = head->next; 81 | } 82 | delete temp; 83 | --dimension; 84 | } 85 | 86 | template 87 | T Stack::top() 88 | { 89 | if(head == NULL) 90 | { 91 | std::cout << "\nStack is empty.\n"; 92 | return -1; 93 | } 94 | return head->data; 95 | } 96 | 97 | template 98 | bool Stack::empty() 99 | { 100 | return !(this->dimension); 101 | } 102 | 103 | template 104 | int Stack::size() 105 | { 106 | return this->dimension; 107 | } 108 | 109 | template 110 | void Stack::clear() 111 | { 112 | while(this->dimension) 113 | { 114 | pop(); 115 | } 116 | } 117 | 118 | //--copy-constructor 119 | template 120 | Stack::Stack(const Stack& S) 121 | { 122 | this->head = NULL; 123 | this->dimension = 0; 124 | 125 | Stack temp; 126 | Node* begin = S.head; 127 | for(int i = 0; i < S.dimension; ++i) 128 | { 129 | temp.push(begin->data); 130 | begin = begin->next; 131 | } 132 | 133 | while(!temp.empty()) 134 | { 135 | push(temp.top()); 136 | temp.pop(); 137 | } 138 | } 139 | 140 | template 141 | Stack& Stack::operator=(const Stack& S) 142 | { 143 | if(this != &S) 144 | { 145 | while(this->dimension) 146 | { 147 | pop(); 148 | } 149 | this->head = NULL; 150 | this->dimension = 0; 151 | 152 | Stack temp; 153 | Node* begin = S.head; 154 | for(int i = 0; i < S.dimension; ++i) 155 | { 156 | temp.push(begin->data); 157 | begin = begin->next; 158 | } 159 | 160 | while(!temp.empty()) 161 | { 162 | push(temp.top()); 163 | temp.pop(); 164 | } 165 | } 166 | return *this; 167 | } 168 | 169 | //--destructor 170 | template 171 | Stack::~Stack() 172 | { 173 | clear(); 174 | } 175 | 176 | template 177 | std::istream& operator>>(std::istream& i, Stack &S) 178 | { 179 | if(S.dimension) 180 | { 181 | S.clear(); 182 | } 183 | int no; 184 | i >> no; 185 | for(int it = 0; it < no; ++it) 186 | { 187 | T value; 188 | i >> value; 189 | S.push(value); 190 | } 191 | return i; 192 | } 193 | template 194 | std::ostream& operator<<(std::ostream& o, Stack &S) 195 | { 196 | while(S.dimension) 197 | { 198 | o << S.top() << " "; 199 | S.pop(); 200 | } 201 | o << "\n"; 202 | return o; 203 | } 204 | 205 | //based on size of stacks 206 | template 207 | bool Stack::operator==(const Stack &S) const 208 | { 209 | return (this->dimension == S.dimension); 210 | } 211 | template 212 | bool Stack::operator>(const Stack &S) const 213 | { 214 | return (this->dimension > S.dimension); 215 | } 216 | template 217 | bool Stack::operator>=(const Stack &S) const 218 | { 219 | return (*this == S) || (*this > S); 220 | } 221 | template 222 | bool Stack::operator<(const Stack &S) const 223 | { 224 | return !(*this > S); 225 | } 226 | template 227 | bool Stack::operator<=(const Stack &S) const 228 | { 229 | return !(*this >= S); 230 | } 231 | template 232 | bool Stack::operator!=(const Stack &S) const 233 | { 234 | return ~(*this == S); 235 | } -------------------------------------------------------------------------------- /Vector/vector.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | template 5 | class VectorIterator; 6 | 7 | template 8 | class Vector 9 | { 10 | private: 11 | int Size; 12 | int Capacity; 13 | type *array; 14 | public: 15 | Vector(int = 0); 16 | Vector(int, type); 17 | Vector(const Vector&); 18 | Vector& operator=(const Vector&); 19 | ~Vector(); 20 | 21 | //capacity 22 | int size(); 23 | void resize(int, type); 24 | int capacity(); 25 | bool empty(); 26 | void rezerve(int); 27 | void shrink_to_fit(); 28 | 29 | //element access 30 | type& operator[](int); 31 | type& at(int); 32 | type& front(); 33 | type& back(); 34 | type* data(); 35 | 36 | //modifiers 37 | void push_back(type); 38 | void pop_back(); 39 | void insert(int, type); 40 | void erase(int); 41 | void clear(); 42 | 43 | //iterator 44 | templateclass VectorIterator; 45 | VectorIterator &createIterator() const 46 | { 47 | return new VectorIterator(*this); 48 | } 49 | }; 50 | 51 | ///IMPLEMENTATION 52 | 53 | template 54 | Vector::Vector(int size_p) 55 | { 56 | if(size_p) 57 | { 58 | this->Capacity = this->Size = size_p; 59 | } 60 | else 61 | { 62 | this->Capacity = 1; 63 | this->Size = 0; 64 | } 65 | array = new type[Capacity]; 66 | } 67 | 68 | template 69 | Vector::Vector(int size_p, type value) 70 | { 71 | if(size_p) 72 | { 73 | this->Capacity = this->Size = size_p; 74 | } 75 | else 76 | { 77 | this->Capacity = 1; 78 | this->Size = 0; 79 | } 80 | 81 | array = new type[Capacity]; 82 | for(int i = 0; i < Size; ++i) 83 | { 84 | array[i] = value; 85 | } 86 | } 87 | 88 | template 89 | Vector::Vector(const Vector &V) 90 | { 91 | this->Capacity = V.Capacity; 92 | this->Size = V.Size; 93 | array = new type[Capacity]; 94 | for(int i = 0; i < Size; ++i) 95 | { 96 | array[i] = V.array[i]; 97 | } 98 | } 99 | 100 | template 101 | Vector& Vector::operator=(const Vector &V) 102 | { 103 | if(this == &V) 104 | { 105 | return *this; 106 | } 107 | 108 | if(this->Size) 109 | { 110 | delete [] array; 111 | } 112 | this->Size = V.Size; 113 | this->Capacity = V.Capacity; 114 | array = new type[Capacity]; 115 | for(int i = 0; i < Size; ++i) 116 | { 117 | array[i] = V.array[i]; 118 | } 119 | return *this; 120 | } 121 | 122 | template 123 | Vector::~Vector() 124 | { 125 | if(this->Size) 126 | { 127 | delete[]array; 128 | } 129 | this->Size = this->Capacity = 0; 130 | } 131 | 132 | //capacity 133 | 134 | template 135 | int Vector::size() 136 | { 137 | return Size; 138 | } 139 | 140 | template 141 | void Vector::resize(int number, type value) 142 | { 143 | if(number < Size) 144 | { 145 | for(int i = Size-1; i >= number; i--) 146 | { 147 | pop_back(); 148 | } 149 | } 150 | 151 | if(number > Size) 152 | { 153 | if(number > Capacity) 154 | { 155 | type *temp = new type[Size]; 156 | for(int i = 0; i < Size; ++i) 157 | { 158 | temp[i] = array[i]; 159 | } 160 | delete [] array; 161 | array = NULL; 162 | 163 | this->Capacity = 2 * number; 164 | array = new type[Capacity]; 165 | 166 | for(int i = 0; i < Size; ++i) 167 | { 168 | array[i] = temp[i]; 169 | } 170 | delete[] temp; 171 | } 172 | for(int i = Size; i < number; ++i) 173 | { 174 | array[i] = value; 175 | } 176 | this->Size = number; 177 | 178 | } 179 | } 180 | 181 | template 182 | int Vector::capacity() 183 | { 184 | return Capacity; 185 | } 186 | 187 | template 188 | bool Vector::empty() 189 | { 190 | return !(Size); 191 | } 192 | 193 | template 194 | void Vector::rezerve(int capacity_p) 195 | { 196 | if(capacity_p > this->Capacity) 197 | { 198 | type *temp = new type[Size]; 199 | for(int i = 0; i < Size; ++i) 200 | { 201 | temp[i] = array[i]; 202 | } 203 | delete [] array; 204 | array = NULL; 205 | 206 | this->Capacity = capacity_p; 207 | array = new type[Capacity]; 208 | 209 | for(int i = 0; i < Size; ++i) 210 | { 211 | array[i] = temp[i]; 212 | } 213 | delete []temp; 214 | } 215 | } 216 | 217 | template 218 | void Vector::shrink_to_fit() 219 | { 220 | type *temp = new type[Size]; 221 | for(int i = 0; i < Size; ++i) 222 | { 223 | temp[i] = array[i]; 224 | } 225 | delete [] array; 226 | array = NULL; 227 | 228 | this->Capacity = this->Size; 229 | array = new type[Capacity]; 230 | 231 | for(int i = 0; i < Size; ++i) 232 | { 233 | array[i] = temp[i]; 234 | } 235 | delete []temp; 236 | } 237 | 238 | 239 | //element access 240 | 241 | 242 | template 243 | type& Vector::operator[](int i) 244 | { 245 | return array[i]; 246 | } 247 | 248 | template 249 | type& Vector::at(int i) 250 | { 251 | if(i < 0 || i > Size-1) 252 | { 253 | throw std::out_of_range("Error!"); 254 | } 255 | 256 | return array[i]; 257 | } 258 | 259 | template 260 | type& Vector::front() 261 | { 262 | if(!this->Size) 263 | { 264 | throw std::out_of_range("Error!"); 265 | } 266 | return array[0]; 267 | } 268 | 269 | template 270 | type& Vector::back() 271 | { 272 | if(!this->Size) 273 | { 274 | throw std::out_of_range("Error!"); 275 | } 276 | return array[Size-1]; 277 | } 278 | 279 | template 280 | type* Vector::data() 281 | { 282 | return array; 283 | } 284 | 285 | 286 | //modifiers 287 | 288 | 289 | template 290 | void Vector::push_back(type value) 291 | { 292 | if(this->Size == this->Capacity) 293 | { 294 | int *temp = new int[Size]; 295 | for(int i = 0; i < Size; ++i) 296 | { 297 | temp[i] = array[i]; 298 | } 299 | delete [] array; 300 | array = NULL; 301 | 302 | this->Capacity *= 2; 303 | array = new type[Capacity]; 304 | 305 | for(int i = 0; i < Size; i++) 306 | { 307 | array[i] = temp[i]; 308 | } 309 | 310 | delete[] temp; 311 | } 312 | this->Size++; 313 | array[Size-1] = value; 314 | } 315 | 316 | template 317 | void Vector::pop_back() 318 | { 319 | if(!this->Size) 320 | { 321 | std::out_of_range("Error!"); 322 | } 323 | Size--; 324 | } 325 | 326 | template 327 | void Vector::insert(int position, type value) 328 | { 329 | if(0 > position || position >= Size) 330 | { 331 | throw std::out_of_range("Error!"); 332 | } 333 | 334 | if(this->Size == this->Capacity) 335 | { 336 | type *temp = new type[Size]; 337 | for(int i = 0; i < Size; ++i) 338 | { 339 | temp[i] = array[i]; 340 | } 341 | delete [] array; 342 | array = NULL; 343 | 344 | this->Capacity *= 2; 345 | array = new type[Capacity]; 346 | 347 | for(int i = 0; i < Size; i++) 348 | { 349 | array[i] = temp[i]; 350 | } 351 | 352 | delete[] temp; 353 | } 354 | for(int i = Size-1; i >= position; i--) 355 | { 356 | array[i+1] = array[i]; 357 | } 358 | array[position] = value; 359 | Size++; 360 | } 361 | 362 | template 363 | void Vector::erase(int position) 364 | { 365 | if(0 > position || position > Size) 366 | { 367 | throw std::out_of_range("Error!"); 368 | } 369 | 370 | Size--; 371 | for(int i = position; i < Size-1; i++) 372 | { 373 | array[i] = array[i+1]; 374 | } 375 | } 376 | 377 | template 378 | void Vector::clear() 379 | { 380 | this->Size = 0; 381 | delete[] array; 382 | this->Capacity = 1; 383 | array = new type[Capacity]; 384 | } -------------------------------------------------------------------------------- /Hotel Booking System/hotel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "twin_room.h" 3 | #include "quadruble_room.h" 4 | #include "stage_room.h" 5 | #include "individual_c_room.h" 6 | #include "restaurant.h" 7 | #include "group.h" 8 | #include "room.h" 9 | #include 10 | #include 11 | 12 | class Hotel 13 | { 14 | private: 15 | std::vector rooms; 16 | int numberRooms; 17 | std::string name; 18 | std::string city; 19 | 20 | bool checkDay(int, Group); 21 | bool checkPeriod(Group); 22 | int getFirstDayReservation(Group); 23 | void bookDay(int, Group); 24 | 25 | public: 26 | Hotel(std::string = "", std::string city = ""); 27 | Hotel(const Hotel&); 28 | Hotel& operator=(const Hotel&); 29 | ~Hotel(); 30 | 31 | void request_reservation(Group); 32 | void introduction(); 33 | 34 | void readData(std::istream&); 35 | void writeData(std::ostream&); 36 | 37 | friend class Group; 38 | 39 | }; 40 | 41 | Hotel::Hotel(std::string name_p, std::string city_p): name(name_p), city(city_p) {} 42 | 43 | Hotel::Hotel(const Hotel& H) 44 | { 45 | for(int i = 1; i <= 365; ++i) 46 | { 47 | this->rooms[i] = H.rooms[i]; 48 | } 49 | this->name = H.name; 50 | this->city = H.city; 51 | } 52 | 53 | Hotel& Hotel::operator=(const Hotel &H) 54 | { 55 | if(this != &H) 56 | { 57 | for(int i = 1; i <= 365; ++i) 58 | { 59 | this->rooms[i] = H.rooms[i]; 60 | } 61 | this->name = H.name; 62 | this->city = H.city; 63 | } 64 | return *this; 65 | } 66 | 67 | Hotel::~Hotel() 68 | { 69 | this->name = ""; 70 | this->city = ""; 71 | rooms.clear(); 72 | } 73 | 74 | void Hotel::readData(std::istream& input) 75 | { 76 | std::cout << "\nEnter the name of the hotel.\n"; 77 | input >> name; 78 | std::cout << "\nEnter the city where the hotel is situated in.\n"; 79 | input >> city; 80 | 81 | std::cout << "\nEnter the number of rooms of the hotel.\n"; 82 | input >> numberRooms; 83 | 84 | int no; 85 | int cnt = 0; 86 | 87 | std::cout << "\nEnter the number of twin rooms.\n"; 88 | input >> no; 89 | 90 | for(int i = 0; i < no; ++i) 91 | { 92 | cnt++; 93 | std::cout << "\nRoom number " << cnt << ".\n"; 94 | std::cout << "Enter the details of the twin room.\n"; 95 | 96 | Room *TR = new TwinRoom(); 97 | TR->readData(input); 98 | rooms.push_back(TR); 99 | } 100 | 101 | std::cout << "\nEnter the number of quadruble rooms.\n"; 102 | input >> no; 103 | 104 | for(int i = 0; i < no; ++i) 105 | { 106 | cnt++; 107 | std::cout << "\nRoom number " << cnt << ".\n"; 108 | std::cout << "Enter the details of the quadruble room.\n"; 109 | 110 | Room *QR = new QuadrubleRoom(); 111 | QR->readData(input); 112 | rooms.push_back(QR); 113 | } 114 | 115 | std::cout << "\nEnter the number of stage conference rooms.\n"; 116 | input >> no; 117 | 118 | for(int i = 0; i < no; ++i) 119 | { 120 | cnt++; 121 | std::cout << "\nRoom number " << cnt << ".\n"; 122 | std::cout << "Enter the details of the stage conference room.\n"; 123 | 124 | Room *SCR = new StageConferenceRoom(); 125 | SCR->readData(input); 126 | rooms.push_back(SCR); 127 | } 128 | 129 | std::cout << "\nEnter the number of individual conference rooms.\n"; 130 | input >> no; 131 | 132 | for(int i = 0; i < no; ++i) 133 | { 134 | cnt++; 135 | std::cout << "\nRoom number " << cnt << ".\n"; 136 | std::cout << "Enter the details of the individual conference room.\n"; 137 | 138 | Room *ICR = new IndividualConferenceRoom(); 139 | ICR->readData(input); 140 | rooms.push_back(ICR); 141 | } 142 | 143 | cnt++; 144 | std::cout << "\nRoom number " << cnt << ".\n"; 145 | 146 | std::cout << "\nEnter the details of the restaurant.\n"; 147 | Room *R = new Restaurant(); 148 | R->readData(input); 149 | rooms.push_back(R); 150 | 151 | } 152 | 153 | void Hotel::writeData(std::ostream& output) 154 | { 155 | output << "\nThe name of the hotel is " << name << ".\n"; 156 | output << "\nThe city where the hotel is situated in is " << city << ".\n"; 157 | output << "\nThe rooms of the hotel are:\n"; 158 | 159 | for(int i = 0; i < numberRooms; ++i) 160 | { 161 | output << "\nRoom." << i+1 << "\n"; 162 | rooms[i]->writeData(output); 163 | } 164 | } 165 | 166 | bool Hotel::checkDay(int day, Group G) 167 | { 168 | int capacity = 0; 169 | for(unsigned int i = 0; i < rooms.size(); ++i) 170 | { 171 | if((rooms[i]->type() == "TwinRoom") || (rooms[i]->type() == "QuadrubleRoom")) 172 | { 173 | capacity += rooms[i]->getCapacity(); 174 | } 175 | } 176 | if(capacity < G.getNumberPeople()) 177 | { 178 | return false; 179 | } 180 | 181 | if(rooms[rooms.size()-1]->getCapacity() < G.getNumberPeopleBreakfast()) 182 | { 183 | return false; 184 | } 185 | 186 | if(G.getConferenceRoom() == 1) 187 | { 188 | bool check = 0; 189 | for(unsigned int i = 0; i < rooms.size(); ++i) 190 | { 191 | if(rooms[i]->type() == "StageConferenceRoom") 192 | { 193 | check = 1; 194 | break; 195 | } 196 | } 197 | if(!check) 198 | { 199 | return false; 200 | } 201 | } 202 | 203 | if(G.getConferenceRoom() == 2) 204 | { 205 | bool check = 0; 206 | for(unsigned int i = 0; i < rooms.size(); ++i) 207 | { 208 | if(rooms[i]->type() == "IndividualConferenceRoom") 209 | { 210 | check = 1; 211 | break; 212 | } 213 | } 214 | if(!check) 215 | { 216 | return false; 217 | } 218 | } 219 | 220 | return true; 221 | } 222 | 223 | bool Hotel::checkPeriod(Group G) 224 | { 225 | 226 | for(int i = 1; i <= 366-G.getPeriod(); ++i) 227 | { 228 | bool check = 1; 229 | for(int j = 0; j <= G.getPeriod()-1; ++j) 230 | { 231 | if(checkDay(i+j,G) == 0) 232 | { 233 | check = 0; 234 | break; 235 | } 236 | } 237 | if(check == 1) 238 | { 239 | return true; 240 | } 241 | } 242 | return false; 243 | } 244 | 245 | int Hotel::getFirstDayReservation(Group G) 246 | { 247 | for(int i = 1; i <= 366-G.getPeriod(); ++i) 248 | { 249 | bool check = 1; 250 | for(int j = 0; j <= G.getPeriod()-1; ++j) 251 | { 252 | if(checkDay(i+j,G) == 0) 253 | { 254 | check = 0; 255 | break; 256 | } 257 | } 258 | if(check == 1) 259 | { 260 | return i; 261 | } 262 | } 263 | return -1; 264 | } 265 | 266 | void Hotel::request_reservation(Group G) 267 | { 268 | if(checkPeriod(G)) 269 | { 270 | int firstDay = getFirstDayReservation(G); 271 | std::cout << "The check in date is " << firstDay <<". The check out day is " << firstDay+G.getPeriod() << ".\n"; 272 | for(int i = 0; i < G.getPeriod(); ++i) 273 | { 274 | bookDay(firstDay+i, G); 275 | } 276 | } 277 | else 278 | { 279 | std::cout << "Sorry, this reservation can't be executed.\n"; 280 | } 281 | } 282 | 283 | void Hotel::bookDay(int day, Group G) 284 | { 285 | int numberppl = G.getNumberPeople(); 286 | for(unsigned int i = 0; i < rooms.size(); ++i) 287 | { 288 | if(rooms[i]->type() == "TwinRoom") 289 | { 290 | if(rooms[i]->getBusyRoom(day) == 0) 291 | { 292 | rooms[i]->setBusyRoom(day, 1); 293 | numberppl -=2; 294 | } 295 | } 296 | if(rooms[i]->type() == "QuadrubleRoom") 297 | { 298 | if(rooms[i]->getBusyRoom(day) == 0) 299 | { 300 | rooms[i]->setBusyRoom(day, 1); 301 | numberppl -=4; 302 | } 303 | } 304 | if(numberppl <= 0) 305 | { 306 | break; 307 | } 308 | } 309 | if(G.getConferenceRoom()) 310 | { 311 | if(G.getConferenceRoom() == 1) 312 | { 313 | for(unsigned int i = 0; i < rooms.size(); ++i) 314 | { 315 | if(rooms[i]->type() == "StageConferenceRoom" && rooms[i]->getBusyRoom(day) == 0) 316 | { 317 | rooms[i]->setBusyRoom(day, 1); 318 | break; 319 | } 320 | } 321 | } 322 | if(G.getConferenceRoom() == 1) 323 | { 324 | for(unsigned int i = 0; i < rooms.size(); ++i) 325 | { 326 | if(rooms[i]->type() == "IndividualConferenceRoom" && rooms[i]->getBusyRoom(day) == 0) 327 | { 328 | rooms[i]->setBusyRoom(day, 1); 329 | break; 330 | } 331 | } 332 | } 333 | } 334 | 335 | } 336 | 337 | void Hotel::introduction() 338 | { 339 | std::cout << "Hello!\nEnter the option you want.\n"; 340 | std::cout << "1.Request a reservation.\n"; 341 | std::cout << "2.The details about the hotel.\n"; 342 | std::cout << "3.Exit.\n"; 343 | } --------------------------------------------------------------------------------