Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The text file students.txt contains students' grading results from the 1st semester. The data values are separated by colons ( : ). Each consecutive column
The text file students.txt contains students' grading results from the 1st semester. The data values are separated by colons ( : ). Each consecutive column represents: . name (string), surname (string), IE grade (float), math grade (float), PE grade (float). Download the file here: students.txt 1. Read the information from the file and store it in a std::vector of Student structures. Design a Student structure to hold all the read data. Additionally, apart from fields to store data from file, the Student structure should include a field to store a mean value of all grades. 2. Write a function calculate_mean_grade which will take a std::vector of Student as a referenced parameter and calculate a mean value of all 3 grades and store it in previously prepared field in each student structure. Call the calculate_mean_grade function for the collection of students read from the file. 3. Create a function called students_with_positive_result that will filter the collection of students to only include ones with all positive partial grades (grades from all subjects above 2.0). The function should take a single argument, a vector of structures and return a new vector of structures. The original argument should remain unmodified. Store the result in a new variable declared in main function. 4. Sort the filtered collection by the mean grade - ascending, from worst to best. AC Go 5. Save sorted data in a new file: students_passed.txt, using the following format: The text file students.txt contains students' grading results from the 1st semester. The data values are separated by colons ( : ). Each consecutive column represents: . name (string), surname (string), IE grade (float), math grade (float), PE grade (float). Download the file here: students.txt 1. Read the information from the file and store it in a std::vector of Student structures. Design a Student structure to hold all the read data. Additionally, apart from fields to store data from file, the Student structure should include a field to store a mean value of all grades. 2. Write a function calculate_mean_grade which will take a std::vector of Student as a referenced parameter and calculate a mean value of all 3 grades and store it in previously prepared field in each student structure. Call the calculate_mean_grade function for the collection of students read from the file. 3. Create a function called students_with_positive_result that will filter the collection of students to only include ones with all positive partial grades (grades from all subjects above 2.0). The function should take a single argument, a vector of structures and return a new vector of structures. The original argument should remain unmodified. Store the result in a new variable declared in main function. 4. Sort the filtered collection by the mean grade - ascending, from worst to best. AC Go 5. Save sorted data in a new file: students_passed.txt, using the following format
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