Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: room.hpp
- Revision:
- 12:d8370e1350db
- Child:
- 13:af3d7d8d77fc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/room.hpp Fri May 03 15:34:30 2019 +0000 @@ -0,0 +1,49 @@ +//////////////////////////////////////////////////////////////////////////////// +// Source File : Room.cpp +// Author : Daniel K. Vinther Wolf +// Date : 02 may 2019 +// Version : 0.1 +// +// Description : Rooms, Class Definition +///////////////////////////////////////80/////////////////////////////////////// + +// Standard IO lib (cin,cout,cerr,clog,wcout) +#include <iostream> + +class Room { +public: + bool RoomCall(unsigned KeyID) { + + Action = Whereabout(KeyID); + + if (Action == 1) { + cout << "Let there be light!" << endl; + return 1; // Sender tÊnd-signal + } else { + cout << "Checkin out.." << endl; + return 0; // Sender sluk-signal + } + } + +private: + unsigned KeyReg[8], i; + bool Action; + bool Whereabout(unsigned KeyID) { + + for(i = 0; i < 8; i++) { + if(KeyID == KeyReg[i]) { + KeyReg[i] = 0; + return 0; // Return 0 for going out of Room + } + } + for(i = 0; i < 8; i++) { + if(KeyReg[i] != 0) + continue; + KeyReg[i] = KeyID; + break; + } + return 1; // Return 1 for going into Room + } + +}; // End Room (Class) +