Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void mainMenu(Student sts[], int tot)
- {
- char option;
- do
- {
- printf("\n\nThere are %d records available", tot);
- printf("\n\nThe actions availabe are:\n");
- printf(" 1. Print a report of the records.\n");
- printf(" 2. Sort the records by the Student Name field\n");
- printf(" 3. Sort the records by the Student ID field.\n");
- printf(" 4. Search for a record by Student name and print the record.\n");
- printf(" 5. Search for a record by Student ID and print the record.\n");
- printf(" 6. Quit\n");
- printf("Choose an action (1-6): ");
- option = getchar();
- switch (option)
- {
- case '1':
- printReport(sts, tot);
- break;
- case '2':
- sortByName(sts, tot);
- printf("The records have been sorted by Student Name field");
- break;
- case '3':
- sortByID(sts, tot);
- printf("The records have been sorted by Student ID field");
- break;
- case '4':
- searchByName(sts, tot);
- break;
- case '5':
- searchByID(sts, tot);
- break;
- case '6':
- break;
- default:
- printf("\nError invalid data, exiting.\n");
- option = '6';
- break;
- }
- }while (option != '6');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement