2020-08-02 11:02:12 +07:00
|
|
|
|
#include "stdio.h"
|
|
|
|
|
#include "stdlib.h"
|
|
|
|
|
|
2020-08-02 11:43:28 +07:00
|
|
|
|
struct person_tag
|
|
|
|
|
{
|
2020-08-02 11:27:05 +07:00
|
|
|
|
char name[20];
|
|
|
|
|
char id[10];
|
|
|
|
|
};
|
|
|
|
|
|
2020-08-02 11:43:28 +07:00
|
|
|
|
struct course_tag
|
|
|
|
|
{
|
2020-08-02 11:27:05 +07:00
|
|
|
|
char course_name[20];
|
|
|
|
|
int no_of_units;
|
|
|
|
|
int marks[4];
|
|
|
|
|
float avg;
|
|
|
|
|
};
|
|
|
|
|
|
2020-08-02 11:43:28 +07:00
|
|
|
|
struct student_tag
|
|
|
|
|
{
|
2020-08-02 11:30:13 +07:00
|
|
|
|
struct person_tag student_info;
|
|
|
|
|
struct course_tag course_info;
|
|
|
|
|
struct student_tag *next;
|
2020-08-02 11:31:44 +07:00
|
|
|
|
};
|
2020-08-02 11:30:13 +07:00
|
|
|
|
|
2020-08-02 11:35:29 +07:00
|
|
|
|
// core functions
|
|
|
|
|
void display_students();
|
|
|
|
|
void search_student();
|
|
|
|
|
void find_maximum();
|
|
|
|
|
void find_failed();
|
2020-08-02 11:27:05 +07:00
|
|
|
|
void update_file();
|
|
|
|
|
void read_file();
|
|
|
|
|
void quite();
|
|
|
|
|
|
2020-08-02 11:35:29 +07:00
|
|
|
|
// util functions
|
|
|
|
|
void display_menu();
|
|
|
|
|
|
2020-08-02 11:43:28 +07:00
|
|
|
|
int main(void)
|
|
|
|
|
{
|
|
|
|
|
// varibales
|
|
|
|
|
int selected;
|
2020-08-02 11:27:05 +07:00
|
|
|
|
|
2020-08-02 11:43:28 +07:00
|
|
|
|
printf("Welcome!\n");
|
|
|
|
|
|
|
|
|
|
display_menu();
|
|
|
|
|
|
|
|
|
|
printf("\nGoodbye!");
|
2020-08-02 11:35:29 +07:00
|
|
|
|
}
|
|
|
|
|
|
2020-08-02 11:43:28 +07:00
|
|
|
|
void display_menu()
|
|
|
|
|
{
|
2020-08-02 11:35:29 +07:00
|
|
|
|
printf("(1) Display students’ details\n");
|
|
|
|
|
printf("(2) Search for a student’s mark\n");
|
|
|
|
|
printf("(3) Find the details of student with the largest average\n");
|
|
|
|
|
printf("(4) Find the details of failed students\n");
|
|
|
|
|
printf("(5) Add new student to the record\n");
|
|
|
|
|
printf("(6) Quit program\n");
|
2020-08-02 11:02:12 +07:00
|
|
|
|
}
|