Question: Figure 2 . Sample output. Student Records: Name: Peppa Pig Major: Engineering Minor: None - Yet Name: George Pig Major: Chemistry Minor: Sciences Name: Daddy

Figure 2. Sample output.
Student Records:
Name: Peppa Pig
Major: Engineering
Minor: None-Yet
Name: George Pig
Major: Chemistry
Minor: Sciences
Name: Daddy Pig
Major: Sciences
Minor: None-Yet
Name: Mummy Pig
Major: Liberal Arts
Minor: Humanities
Name: Suzy Sheep
Major: Engineering
Minor: None-Yet
Name: Rebecca Rabbit
Major: Liberal Arts
Minor: None-Yet
Name: Pedro Pony
Major: Sciences
Minor: Liberal Arts
Lab 07- Functions
The disk file "c:/temp/students.txt" contains a list of student records (see Figure 1).
Each student record is formatted as follows: the first line holds the character name, and the second line has two three-digit numbers. The first number represents the students' declared undergraduate school major, and the second
represents their minor program (if any!)
Table 1. The following values are used to encode undergraduate programs.
000 None-Yet
100 Liberal Arts
200 Chemistry
300 Engineering
400 Sciences
500 Humanities
600 Law
Write a C++ program to read the student file and nicely print each student record. The app must include the following two functions
string getMajorMinor(int numCode)
For example, if you pass the argument 300, it returns Engineering".
The second function is void getStudentRecord(ifstream& 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 Figure1. Figure 2. shows a sample output.
Figure 1. Student Records (c:/temp/students.txt) PLEASE DONT USE SWITCH STATEMENT FOR getMajorMinor Function
Figure 2 . Sample output. Student Records: Name:

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 Programming Questions!