Question
Write a program that provides a way for you to search and display information of all the students in a class. Student records including a
Write a program that provides a way for you to search and display information of all the students in a class. Student records including a class ID (c#), name of the student, and scores of multiple categories are saved in the file grades.dat. Your program should:
- First, read all student information from the text file and store them in an array.
- Then display information of all the students in table format.
- Prompt user to input a valid c#, and the program display all the information of the student with the given c#. (when invalid c# is entered, continue to prompt until a valid c# is entered)
- Sort all the students by name, and display information of all the students in table format.
Requirements
You are required to:
- declare a structure StudentType to hold all information of a student, such as c#, name and all scores.
- declare a local variable roster in main function as an array of Student structure. This array will hold information of all students.
- declare and implement the following functions:
- a function to read from the text file
- a function to print information of all the students in table form
- a function to print information of one student, with label for each data
- a function to check whether a class ID is valid
- a function to sort all students by name Function prototypes should be used for all user defined functions. Global variables are not allowed.
Example output
Here are the information of the 17 students:
ClassID Name CLA OLA Homework Exam Bonus
c0801 Tony 10 15 15 56 3
c0802 Sam 9 12 11 46 2
c0803 Bradly 8 10 12 50 1
c0804 Joy 5 5 10 53 3
c0805 Kimberly 3 11 10 45 0
c0806 Mike 8 14 11 40 1
c0807 Henry 4 12 12 48 2
c0808 Katy 10 10 11 36 0
c0809 Charles 8 8 11 39 0
c0810 Noah 6 9 9 47 3
c0811 Henry 8 7 13 41 3
c0812 Alexander 4 11 11 37 1
c0813 Rihanna 9 15 8 50 2
c0814 Sophia 8 12 10 48 3
c0815 Jordan 6 8 7 45 1
c0816 Natalie 7 7 6 51 2
c0817 Matthew 8 9 12 38 2
Enter a valid class ID:c0830
Enter a valid class ID:c0800
Enter a valid class ID:c0804
Information for student with ID :c0804:
Name : Joy
CLA : 5
OLA : 5
Homework : 10
Exam : 53
Bonus : 3
sorting student records by name ....
Here are the information of the 17 students:
ClassID Name CLA OLA Homework Exam Bonus
c0812 Alexander 4 11 11 37 1
c0803 Bradly 8 10 12 50 1
c0809 Charles 8 8 11 39 0
c0807 Henry 4 12 12 48 2
c0811 Henry 8 7 13 41 3
c0815 Jordan 6 8 7 45 1
c0804 Joy 5 5 10 53 3
c0808 Katy 10 10 11 36 0
c0805 Kimberly 3 11 10 45 0
c0817 Matthew 8 9 12 38 2
c0806 Mike 8 14 11 40 1
c0816 Natalie 7 7 6 51 2
c0810 Noah 6 9 9 47 3
c0813 Rihanna 9 15 8 50 2
c0802 Sam 9 12 11 46 2
c0814 Sophia 8 12 10 48 3
c0801 Tony 10 15 15 56 3
Step by Step Solution
3.53 Rating (153 Votes )
There are 3 Steps involved in it
Step: 1
The simple C program that meets the requirements youve specified This program reads student information from a file displays it in table format allows ...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