Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

}

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions

Question

Demonstrated skills in Microsoft Office Suite

Answered: 1 week ago

Question

What are the skills of management ?

Answered: 1 week ago