Question: Lab 0 7 - Functions The disk file cs / temp / students . txt contains a list of student records ( see

Lab 07- Functions
The disk file "cs/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.
```
300 Engineering
```
```
500\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 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)
```
Peppa Pig
300000
George Pig
200400
Daddy Pig
```
```
Mummy Pig
100500
Suzy Sheep
300000
Rebecca Rabbit
100000
Pedro Pony
400100
``` Figure 2. Sample surpur.
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 0 7 - Functions The disk file " cs / temp /

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!