Question: Write the program given below in c language. Do not use c ++ commands !!! #include #include #include #include #include using namespace std; static int

Write the program given below in c language. Do not use c ++ commands !!!

Write the program given below in c language. Do not use c

#include

#include

#include

#include

#include

using namespace std;

static int p = 0;

class a

{

char busn[5], driver[10], arrival[5], depart[5], from[10], to[10], seat[8][4][10];

public:

void install();

void allotment();

void empty();

void show();

void avail();

void position(int i);

}

bus[10];

void vline(char ch)

{

for (int i=80;i>0;i--)

cout

}

void a::install()

{

cout

cin>>bus[p].busn;

cout

cin>>bus[p].driver;

cout

cin>>bus[p].arrival;

cout

cin>>bus[p].depart;

cout

cin>>bus[p].from;

cout

cin>>bus[p].to;

bus[p].empty();

p++;

}

void a::allotment()

{

int seat;

char number[5];

top:

cout

cin>>number;

int n;

for(n=0;n

{

if(strcmp(bus[n].busn, number)==0)

break;

}

while(n

{

cout

cin>>seat;

if(seat>32)

{

cout

}

else

{

if (strcmp(bus[n].seat[seat/4][(seat%4)-1], "Empty")==0)

{

cout

cin>>bus[n].seat[seat/4][(seat%4)-1];

break;

}

else

cout

}

}

if(n>p)

{

cout

goto top;

}

}

void a::empty()

{

for(int i=0; i

{

for(int j=0;j

{

strcpy(bus[p].seat[i][j], "Empty");

}

}

}

void a::show()

{

int n;

char number[5];

cout

cin>>number;

for(n=0;n

{

if(strcmp(bus[n].busn, number)==0)

break;

}

while(n

{

vline('*');

cout

bus[n].to

vline('*');

bus[0].position(n);

int a=1;

for (int i=0; i

{

for(int j=0;j

{

a++;

if(strcmp(bus[n].seat[i][j],"Empty")!=0)

cout

}

}

break;

}

if(n>p)

cout

}

void a::position(int l)

{

int s=0;p=0;

for (int i =0; i

{

cout

for (int j = 0;j

{

s++;

if(strcmp(bus[l].seat[i][j], "Empty")==0)

{

cout.width(5);

cout.fill(' ');

cout

cout.width(10);

cout.fill(' ');

cout

p++;

}

else

{

cout.width(5);

cout.fill(' ');

cout

cout.width(10);

cout.fill(' ');

cout

}

}

}

cout

}

void a::avail()

{

for(int n=0;n

{

vline('*');

cout

vline('*');

vline('_');

}

}

int main()

{

system("cls");

int w;

while(1)

{

//system("cls"); cout

cout

cout

cout

cin>>w;

switch(w)

{

case 1: bus[p].install();

break;

case 2: bus[p].allotment();

break;

case 3: bus[0].show();

break;

case 4: bus[0].avail();

break;

case 5: exit(0);

}

}

return 0;

}

C:\Users\ASUS\Desktop\SBRS-C\SBRSC.exe x ***SIMPLE BUS RESERVATION SYSTEM*** 1. Install 2. Reservation 3.Show 4.Buses Available 5.Exit Enter your choice

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!