Question: Lab 0 7 - Functions The disk file cs / temp / students . txt contains a list of student records ( see
Lab Functions
The disk file cstempstudentstxt contains a list of student records see Figure
Each student record is formatted as follows: the first line holds the character name, and the second line has two threedigit numbers. The first number represents the students' declared undergraduate school major, and the second represents their minor program if any!
Table The following values are used to encode undergraduate programs.
Engineering
text Humanities
Write a C program to read the student file and nicely print each student record. The app must include the following two functions
string getMajorMinorint numCode
For example, if you pass the argument it returns Engineering".
The second function is
void getStudentRecordifstream& studentFile, string& studName, string& major, string& minor
This function reads the disk data, calls the getMajorMinor function to find the textual version of the student's major and minor and returns those three values to the caller.
Test the program with the data shown in Figure Figure shows a sample output.
Figure Student Records c:tempstudentstxt
Peppa Pig
George Pig
Daddy Pig
Mummy Pig
Suzy Sheep
Rebecca Rabbit
Pedro Pony
Figure Sample surpur.
Student Records:
Name: Peppa Pig
Major: Engineering
Minor: NoneYet
Name: George Pig
Major: Chemistry
Minor: Sciences
Name: Daddy Pig
Major: Sciences
Minor: NoneYet
Name: Mummy Pig
Major: Liberal Arts
Minor: Humanities
Name: Suzy Sheep
Major: Engineering
Minor: NoneYet
Name: Rebecca Rabbit
Major: Liberal Arts
Minor: NoneYet
Name: Pedro Pony
Major: Sciences
Minor: Liberal Arts
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
