A array is not what you need I think. Certainly not a "4d" one. In console arrays go up to 3 dimensions. a 2d array would get you a grid, adding a 3rd gets you depth and would be used for 3d games or such.
sounds like using a class might be better
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
class Room{
public:
// not going to write them for you, but here you would use access-er methods like:
int getMonth();
int setMonth(int month);
// etc
private:
int itsMonth;
int itsDate;
int itsFloor;
int itsNumber; // room number
}
|
You of course would also need to define the functions. Anyways, using this method you could then make an array of rooms.
the other way is to use a Initializer List
1 2 3
|
public:
Room( int itsMonth, int itsDate, int itsFloor, itsNumber):
itsMonth(month), itsDate(date), etc etc
|
and then declare your room like:
Room bestSuite(3,5,2,123) which would make a room called bestSuite and set its Month to 3, date to 5, floor to 2, and number to 123
then in your program you would have to check if it was free:
1 2 3 4
|
if (bestSuite(month = 3)){
roomIsFree = false;
cout << "Room is taken";
}
|
Obviously none of that code is complete or even fully correct but those are the type of concepts you would use.