Question
Could you complete the four functions at the bottom of the source code? Here's the incomplete source code below. ------------------------------------------------- #include #include #include using namespace
Could you complete the four functions at the bottom of the source code?
Here's the incomplete source code below.
-------------------------------------------------
#include
#include
#include
using namespace std;
struct Student {
string firstName;
string lastName;
int id;
};
struct Course {
string name;
int crn;
int section;
};
struct Enrollment {
Student s;
Course c;
};
void load(Enrollment e[]);
void print(Enrollment e[]);
void searchS(Enrollment e[]);
void searchC(Enrollment e[]);
int main() {
// init vars
Enrollment e[1000];
char sc = 'a';
// set up array
load(e);
print(e);
// menu loop
while(sc != 'e') {
// prompt and get menu choice
cout << endl << endl << endl
<< "Would you like to search enrollments by student, by course, or exit (s / c / e): ";
cin >> sc;
// choose function based on user input
if(sc == 'c') {
searchC(e);
} else if(sc == 's') {
searchS(e);
} else {
cout << "That was not a valid option, please try again!";
}
}
return 0;
}
// this function gets the file path from the user
// then opens the file, reads it with a loop,
// and saves the data read from the file into the array
void load(Enrollment e[]) {
}
// this function prints the contents of the array
// prettily using the setw function (#include
void print(Enrollment e[]) {
}
// this function searches the array e by student name
// and prints out any enrollment data for that student
void searchS(Enrollment e[]) {
}
// this function searches the array e by class name and id
// and prints out any enrollment data for that class
void searchC(Enrollment e[]) {
}
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