﻿ C exercises and solutions: C structure

# C exercises and solutions: C structure

## C structure: Student Record

Write a C program to keep records and perform statistical analysis for a class of 20 students. The information of each student contains ID, Name, Sex, quizzes Scores (2 quizzes per semester), mid-term score, final score, and total score.
The program will prompt the user to choose the operation of records from a menu as shown below:
============================================

============================================

2. Delete student records

3. Update student records

4. View all student records

5. Calculate an average of a selected student’s scores

6. Show student who gets the max total score

7. Show student who gets the min total score

8. Find student by ID

9. Sort records by total scores

Note: All students records store in an array of structures

Solution:

To keep this solution simple and easy to follow, we divide this solution in to different steps:
Step 1: Declaring a structure called student to store the records. The structure student contains nine members:
-stnumber(string) to store the student' id
-stname(array of characters) to store the student's name

-sex(char) to store the student's sex

-quiz1(float) to store the first quiz score

-quiz2(float) to store the second quiz score

-assignment(float) to store the assignment score

-midterm(float) to store the mid-term score

-final(float) to store the final score

-total(float) to store the total score

typedef struct
{

string stnumber;
char stname[20];
char sex;
float quiz1;
float quiz2;
float assignment;
float midterm;
float final;
float total;

}student;