Add looping the menu

This commit is contained in:
2020-08-02 18:10:37 +07:00
parent 284a856634
commit b277d96c36
4 changed files with 346 additions and 26 deletions

View File

@@ -3,7 +3,7 @@
#define BUFFER_SIZE 128
const char *FILE_STUDENT_DATA_PATH = "./data/students.test.txt";
const char *FILE_STUDENT_DATA_PATH = "./data/students.txt";
struct person_tag
{
@@ -58,32 +58,35 @@ int main(void)
display_menu();
printf("Enter your option: ");
scanf("%d", &selected);
switch (selected)
while (1)
{
case 1:
display_students();
break;
case 2:
search_student();
break;
case 3:
find_maximum();
break;
case 4:
find_failed();
break;
case 5:
update_file();
break;
case 6:
quite();
break;
default:
printf("cannot find your option!");
break;
printf("Enter your option: ");
scanf("%d", &selected);
switch (selected)
{
case 1:
display_students();
break;
case 2:
search_student();
break;
case 3:
find_maximum();
break;
case 4:
find_failed();
break;
case 5:
update_file();
break;
case 6:
quite();
break;
default:
printf("cannot find your option!");
break;
}
}
}
@@ -94,6 +97,7 @@ void print_welcome()
void display_students()
{
printf("\n");
read_student_to_data();
}