Advertisement
Guest User

Untitled

a guest
Jul 30th, 2014
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.56 KB | None | 0 0
  1. void mainMenu(Student sts[], int tot)
  2. {
  3.  
  4.         char option;
  5.         do
  6.         {
  7.  
  8.             printf("\n\nThere are %d records available", tot);
  9.  
  10.             printf("\n\nThe actions availabe are:\n");
  11.             printf("    1. Print a report of the records.\n");
  12.             printf("    2. Sort the records by the Student Name field\n");
  13.             printf("    3. Sort the records by the Student ID field.\n");
  14.             printf("    4. Search for a record by Student name and print the record.\n");
  15.             printf("    5. Search for a record by Student ID and print the record.\n");
  16.             printf("    6. Quit\n");
  17.  
  18.             printf("Choose an action (1-6): ");
  19.             option = getchar();
  20.  
  21.             switch (option)
  22.             {
  23.             case '1':
  24.                 printReport(sts, tot);
  25.                 break;
  26.             case '2':
  27.                 sortByName(sts, tot);
  28.                 printf("The records have been sorted by Student Name field");
  29.                 break;
  30.             case '3':
  31.                 sortByID(sts, tot);
  32.                 printf("The records have been sorted by Student ID field");
  33.                 break;
  34.             case '4':
  35.                 searchByName(sts, tot);
  36.                 break;
  37.             case '5':
  38.                 searchByID(sts, tot);
  39.                 break;
  40.             case '6':
  41.                 break;
  42.             default:
  43.                 printf("\nError invalid data, exiting.\n");
  44.                 option = '6';
  45.                 break;
  46.  
  47.             }
  48.  
  49.         }while (option != '6');
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement