Question
TASK: Write a C program that reads information related to students and their grades from afile and print the contents together with the average of
TASK: Write a C program that reads information related to students and their grades from afile and print the contents together with the average of the scores
Create a struct with the type Student to hold thefollowing information:
Name of the student
grade from english course
grade from math course
grade from physics course
Assume that you know how many records there are in thefile, hence create an array of structs statically
Assume that you know the order of the information andthe type of information at each line: name, scores ofenglish, math and physics courses
Write a function to read the contents from scores.txt andstore them in the structs you created
Provide the checks for successfully reading fromthe file
Write a function to print the contents of a struct variableon the screen
Print the contents of the students on the screen
Print the average of each score on the screen
The output looks like this
The following file is scores.txt
Gintoki Sakata 45 30 80 Ace Portgas D. 60 80 75 Spike Spiegel 65 45 65 Killua Zoldyck 70 55 80 Takashi Natsume 80 90 75 Levi Ackerman 80 75 75
Use the functions written .
#DEFINE SIZE 6
#DEFINE NUM_OF_SCORES 5
struct student(){}
void store_info(FILE* file, student*,..stu)
void print (student* stu){}
typedet str
int main(){}
Please code what is given in the Task in C. It is important that you also include a screenshot of the output. THANK YOU
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