tiffprag

intMain

Jan 21st, 2020
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.96 KB | None | 0 0
  1. //Code Generation Language Standard have to be changed to ISO C++ 11
  2.  
  3. #include <iostream>
  4.  
  5. #include "FunctionsClass.h"
  6.  
  7. using namespace std;
  8.  
  9. //GLOBAL VARIABLES
  10. Functions call;
  11.  
  12. int main(){
  13.   //DEFAULT RESERVATIONS
  14.   if(foundTextFile == 0){
  15.     call.defaultRecords(records);
  16.   }
  17.  
  18.   char choice;
  19.   cout << "===============RESTAURANT RESERVATION SYSTEM II===============" << endl<<endl;
  20.   if(foundTextFile == 0){
  21.     cout<<"< Currently using default reservation records >"<<endl<<endl;
  22.   }else{
  23.     cout<<"< Current Reservation Records : "<<fileDirectory<<" >"<<endl<<endl;
  24.   }
  25.  
  26.   cout<< "Please enter your selection" << endl <<
  27.     "1. Import Text File Data" << endl <<
  28.     "2. Display All Sorted by..." << endl <<
  29.     "3. Search & Display..." << endl <<
  30.     "4. Given...display all..." << endl <<
  31.     "5. Exit" << endl;
  32.  
  33.   cout << "Choice: ";
  34.   cin >> choice;
  35.   cin.clear();
  36.   cin.ignore(1, '\n');
  37.   system("CLS");
  38.  
  39.   switch (choice) {
  40.   //Display All Sorted by...
  41.   case '1':
  42.     cout<<"Enter 0 to return to main menu."<<endl<<endl;
  43.  
  44.     cout<<"NOTE : - Only the .txt file created from the 'Restaurant Reservation System I' can be used."<<endl
  45.     <<"       - Only "<<MAX<<" reservations are allowed."<<endl<<endl;
  46.  
  47.     cout<<"Please enter file directory of .txt file (e.g : /Users/TiffanyP/Desktop/Reservations.txt) : "<<endl;
  48.     cin>>fileDirectory;
  49.  
  50.     if(fileDirectory != "0"){
  51.       call.readTextFile(fileDirectory, records);
  52.     }
  53.  
  54.     getchar();
  55.     cout <<endl<< "Press enter to continue . . .";
  56.     cin.clear();
  57.     cin.ignore(1000, '\n');
  58.     system("CLS");
  59.     main();
  60.  
  61.   //Display All Sorted by...
  62.   case '2':
  63.     call.displayAll();
  64.     main();
  65.  
  66.   //Search...
  67.   case '3':
  68.     call.searchNDisplay();
  69.     main();
  70.  
  71.   //Given...display all
  72.   case '4':
  73.     call.givenDisplayAll();
  74.     main();
  75.  
  76.   case '5':
  77.     exit(1);
  78.  
  79.   default:
  80.     cout << choice << " is not valid choice" << endl;
  81.     main();
  82.   }
  83.  
  84.   return 0;
  85. }
Add Comment
Please, Sign In to add comment