Question: Please modify this code(use this code) Thank you:) #include #include using namespace std; /* ... ... */ struct Lab { string name; int nrComp; bool

Please modify this code(use this code)

Thank you:)

#include

#include

using namespace std;

/*

...

...

*/

struct Lab {

string name;

int nrComp;

bool avail;

};

void readLab(struct Lab & );

void displayLab(struct Lab);

void compareLab(struct Lab,struct Lab);

int main()

{

struct Lab ourLab; // declaration of variable of the struct type

struct Lab anotherLab;

readLab(ourLab); //call

displayLab(ourLab);//call

readLab(anotherLab);

displayLab(anotherLab);//call

copareLab(ourLab,anotherLab);//call to compare number of computers in nthe labs

}

void readLab(struct Lab &aLab)

{

char answer;

cout

cin >> aLab.name;

cout

cin >> aLab.nrComp;

cout

cin >> answer;

if (answer == 'Y')

aLab.avail = true;

else

aLab.avail = false;

}

void displayLab(struct Lab aLab)

{

if (aLab.avail)

cout

else

cout

}

void compareLab(struct Lab aLab,struct Lab bLab)

{

if (aLab.nrcomp>bLab.nrcomp)

cout

else

if (aLab.nrComp==bLab.nrComp)

cout

else

cout

}

 Please modify this code(use this code) Thank you:) #include #include using

Change the program to use instead of just one file (main.cpp), three files (main.cpp, *.h, and *.cpp) - This is called Encapsulation of the Code Add 1 more function, that allows changing the number of computers in a lab

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!