From 483d63fa7249ad8d6020680c48c3cf6df35010b3 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Wed, 26 Apr 2017 16:37:39 +0200 Subject: Moved all C++ files into CPP folder --- ascensore.cc | 90 ------------------------------------------------------------ 1 file changed, 90 deletions(-) delete mode 100644 ascensore.cc (limited to 'ascensore.cc') diff --git a/ascensore.cc b/ascensore.cc deleted file mode 100644 index 8e69964..0000000 --- a/ascensore.cc +++ /dev/null @@ -1,90 +0,0 @@ -#include -#include -#include -#include - -class Ascensore -{ -private: - unsigned short int floor; - bool doors; - unsigned short int maxFloor; -public: - Ascensore(unsigned short int plan = 0) {floor = plan; maxFloor = 5;} - void Up(void); - void Down(void); - void Doors(void); - void getFloor(void); -}; - -void _clear(void); - -using namespace std; - -int main(void) -{ - char choose; - Ascensore *ascensore = new Ascensore(); - do { - ascensore->getFloor(); - cin >> choose; - choose = tolower(choose); - if(choose == 'u' || choose == 'd') ascensore->Doors(); - sleep(2); - switch(choose) - { - case 'u' : ascensore->Up(); break; - case 'd' : ascensore->Down(); break; - case 'e' : break; - } - _clear(); - if(choose == 'u' || choose == 'd') ascensore->Doors(); - } while(choose != 'e'); - - cout << "SEI USCITO DALL'ASCENSORE CON SUCCESSO!"; - - return 0; -} - -void _clear(void) -{ - #ifdef OS_WINDOWS - system("CLS"); - #else - system("clear"); - #endif -} - -void Ascensore::getFloor(void) -{ - if(floor == maxFloor) cout << "Sei arrivato all'ultimo piano" << endl; - if(floor == 0) cout << "Non puoi scendere più di così" << endl; - cout << "SEI ATTUALMENTE AL PIANO " << floor << endl; - cout << "\nQUALE AZIONE SI VUOLE COMPIERE?" << endl; - cout << "U - salire" << endl; - cout << "D - scendere" << endl; - cout << "E - Uscire" << endl; - cout << "> "; -} - -void Ascensore::Up(void) -{ - if(floor < maxFloor) floor+=1; -} - -void Ascensore::Down(void) -{ - if(floor > 0) floor-=1; -} - -void Ascensore::Doors(void) -{ - if(doors == true) - { - cout << "> APERTURA PORTE" << endl; - doors = false; - } else { - cout << "> CHIUSURA PORTE..." << endl; - doors = true; - } -} -- cgit v1.2.3-18-g5258