Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The purpose of this program is to create a grade report for a course. Write a pr

ID: 3696224 • Letter: T

Question

The purpose of this program is to create a grade report for a course. Write a program that stores the following data about a student in a structure studentRecord - Student’s Name: string type (only FirstName) - Student ID: int type - Assignment Scores: array of 4 integers. Each score is from 100 points. - Average: double type There are 3 students in a course. So, you need to create array of structures to hold data of the three students. When the program runs, it should read the data for each student from a file students.txt (see example below for file format). Average needs to be calculated in your program. It should display data in tabular form that lists each student’s name, ID, and the 4 assignment scores along with the calculated average of their assignment scores respectively. The program should also calculate and display the Name and ID of the student receiving the highest average.

Format of students.txt:

Will
110
65 90 85 84
Taylor
60
90 86 92 89
Johnny
150
62 80 73 75

Explanation / Answer

#include <stdio.h>

#include <stdlib.h>

int main()

{

   char name[50], file_name[25] ;

   int ID, marks[4], total=0, avg;

   FILE *fp;

   printf("Enter the name of file you wish to see ");

   gets(file_name);

   fp = fopen(file_name,"r"); // read mode

   if( fp == NULL )

   {

      perror("Error while opening the file. ");

      exit(EXIT_FAILURE);

   }

fscanf(fptr,"%s",name);

fscanf(fptr,"%d",ID);

            for(i=0;i<4;i++)

            {

fscanf(fptr,"%d",&marks[i]);

total=total+marks[i];

            }

avg=total/400;

for(i=0;i<3;i++) // for 3 students in text file

printf(" Name: %s Total:%d Average:%d ",name,total,avg);

   fclose(fp);

   return 0;

}

note- the above code can help to answer the given question.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote