1 Perform a program of an arrangement of 20 positions Each p
Solution
I have did it in C++
#include <iostream>
#define BUSY 1
#define EMPTY 0
/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */
using namespace std;
int main(int argc, char** argv) {
int arr[20],ticket;
char ch;
cout << \"\\t\\tWELCOME TO THE BUS TICKET INFORMATION SYSTEM\ \";
for(int i=0;i<20;i++)
arr[i] = 0;
do{
cout << \"\ A.Ticket Sale()\ B.Inquires()\ C.Report()\ D.get Out[\'s\' for exit]\ Choose your option:\\t\";
cin >> ch;
switch(ch){
case \'A\':
cout << \"\ Enter the seat you want:\\t\";
cin >> ticket;
if(ticket >0 && ticket <=20){
for(int i=0;i<20;i++){
if(arr[ticket]==EMPTY){
arr[ticket] = BUSY;
}
}
}
break;
case \'B\':cout << \"\ Enter seat number:\\t\";
cin >> ticket;
if(arr[ticket] == BUSY)
cout << \"\\t\" <<ticket << \" is OCCUPIED:\ \";
else
cout << \"\\t\" << ticket << \" is NOT OCCUPIED:\ \";
break;
case \'C\':
for(int i=0;i<20;i++){
if(arr[i] == BUSY)
cout << \"\\t\" << i << \" >>> BUSY\ \";
else
cout << \"\\t\" <<i << \" >>> EMPTY\ \";
}
break;
case \'D\' : exit(0);
default : cout << \"Wrong Input\ \";
}
}while(true);
return 0;
}

