#include "stdafx.h"
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
const int NO_ROOMS = 4;
const int NO_LEVELS = 3;
const int NO_ROWS = 9;
const int NO_SEATS = 15;
const string filler = " _____________________________________________________________";
enum room { ROOM1, ROOM2, ROOM3, ROOM4 };
enum level { FRONT, MIDDLE, UPPER };
enum rows { A, B, C, D, E, F, G, H, I, J };
int main()
{
char theater[NO_ROOMS][NO_LEVELS][NO_ROWS][NO_SEATS];
int i, j, k, l;
char seat;
for (i = 0; i < NO_ROOMS; i++)
for (j = 0; j < NO_LEVELS; j++)
for (k = 0; k < NO_ROWS; k++)
for (l = 0; l < NO_SEATS; l++)
theater[i][j][k][l] = ' ';
theater[2][2][5][8] = 'X';
theater[1][3][10][15] = 'X';
theater[2][1][9][2] = 'X';
for (i = 0; i < NO_ROOMS; i++)
{
cout << "Room " << i + 1 << endl;
for (j = 0; j < NO_LEVELS; j++)
{
cout << " Level " << j + 1 << endl;
cout << filler << endl;
for (k = 0; k < NO_ROWS; k++)
{
cout << "Row " << k + 1 << "|";
for (l = 0; l < NO_SEATS; l++)
{
if (theater[i][j][k][l] == 'X')
cout << " " << theater[i][j][k][l] << " |";
else
cout << " " << l << " |";
}
cout << endl << filler << endl;
}
cout << "\n\n";
}
}
}
1 comment:
Thanks for the interesting posts1 Your blog is very nice for the beginners :)
Post a Comment