subject
Computers and Technology, 10.06.2021 18:10 mat1413

For each section: The first line contains two positive integers, st (st s 500) and m (m s 20), where st represents the number of students in the section and m represents the number of assignments in the section. The following st number of lines represents data for the st number of students (each line for each student). A student data line contains a positive integer, id (id s 500,000), a string Iname (all lower case letters, max length s 20), and m positive floating point numbers (each number is s 100.0) separated by spaces, where id represents the id number of the student, Iname represents the last name of the student, and the m positive floating pointing numbers represent the scores of the student on the m assignments for the course. Assume that the id numbers are unique for each student. Similarly, the file contains data for s number sections for the course cn. Similarly, the file contains data for all the courses for each test case. Output (to standard output): For each test case, output a single line header with the following format: test case x where x is the test case number, starting with one. Within each test case, produce a single line of output for each course. For each course, display the course name (in the same order they appear in the file), total number of students who passed the course, the average scores for each section of the course in the same order they appear in the file), id, last name and average score of the student who achieved highest average score in the assignments of the entire course regardless of section (print the first student, in terms of where they appear in the file, if multiple students achieved the highest score). Display the result in one course per line in the following format: course_name pass_count list_of_averages_section(separated by space rounded to exactly two decimal places) id lname avg_score (rounded to exactly two decimal places) Where course_name is the name of the course, pass_count is the total number of students passed the course, list_of_averages_section is the list of average scores per section of the course, id, lname and avg_score is the id, last name, and average score of the student who achieved the highest score in the course. A partial view of the memory map of the arrays will be like the following figure. Courses is an array of course. Sections of a course is an array of arrays of students (a. k.a 2D array of students). sections [0] sections [1] student [0] 1/st=num_students(0) Student [st-1] Courses [0] scores (0) scoresto] scores (0) scores [0] Courses [1] sections (num sections-1] scores (m- 1] scores (m-1) scores (m-1) scores (m-1) Courses [21 //m=num_scores[0] Array of students like above Courses (C-1) sections (0) sections (1) student (0) Student Ist- scores01 scores (0) score101 scores (01 sectionsnum sections-1] scores (n-1) scores (n-1) scores (n-1) //m=num_scores[0] scores (m-1) 2. You have to use dynamic memory allocation for the arrays and strings based on the size and data you will receive from the file. 3. After processing the job of a test case, you must have to free memory appropriately. 4. Your code should implement at least the following functions: a. course" read_courses (int *num_courses): This function takes the reference of an integer to track how may courses the file has. Then it reads the data for an entire test case and return the allocated memory for all the courses (including sections) for a test case. Note that you can call other functions from this function as needed.
b. student** read_sections(int num_students[], int num_scores[], int num_sections): This function takes the references of two arrays, one for number of students, and one for number of scores for a course, as well as the number of sections, which is the length of both arrays. The function reads all the data for all the sections of a course, fills up the num_students and num_scores array of the course and returns a 2D array of students that contains all the data for all the sections of a course. A good idea would be calling this function from the read_course function.
c. void process_courses (course "courses, int num_courses): This function takes the array of courses produced and filled by all the courses of a test case and the size of the array. It displays the required data in the same format discussed in the sample output. You can write and use more functions in this process as you wish.
d. void release_courses ( course *courses, int num_courses): This function takes the array of courses produced and filled by all the courses of a test case and also takes the size of the array. It frees up all the memory allocated within it. You can create more function as needed to ease the process.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 14:00
Which database model is best used for data warehouse and data mining
Answers: 3
question
Computers and Technology, 23.06.2019 06:40
How many nibbles can be stored in a 16-bit word?
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
Facial expressions and gestures are examples of messages.
Answers: 3
question
Computers and Technology, 23.06.2019 18:30
The computers in the sales department did not have enough data storage capacity to contain all the information the department needed to store, and it was taking a long time for team members to access the data they needed. to fix the problem, the technician installed new, larger hard drives on all the computers.
Answers: 1
You know the right answer?
For each section: The first line contains two positive integers, st (st s 500) and m (m s 20), where...
Questions
question
Computers and Technology, 11.07.2019 13:30
question
Social Studies, 11.07.2019 13:30
question
Mathematics, 11.07.2019 13:30
Questions on the website: 13722360