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
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started