Advertisement
Guest User

Untitled

a guest
Nov 13th, 2015
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.61 KB | None | 0 0
  1.  
  2. #include "Data.h"
  3. #include "Heap.h"
  4. #include "PQ.h"
  5.  
  6.  
  7.  
  8. #include <iostream>
  9. using namespace std;
  10. //**********************************************************
  11. void enqRequest(int newTrackNum, int currP ,int serialNumber)
  12. {
  13.  cout << "Do the EnqRequest function."<<endl;
  14.  cout <<endl<<endl;
  15.  cout <<"Enter a New Track Number"<<endl;
  16.  cin >> newTrackNum;
  17.  
  18.     if (newTrackNum >= 0 && newTrackNum <= 9) {
  19.        
  20.    
  21.    
  22.    
  23.  cout <<"EnqRequest   "<<newTrackNum<<endl;
  24.  cout << endl << endl;
  25.  cout <<"Current Position: .............."<<currP<<endl;
  26.  cout <<"Current Direction: ............."<<endl;
  27.  cout <<"Request was Enqueued in the: ..."<<endl;
  28.  cout <<"Number of Request is: ......"<<endl;
  29.  cout <<"============================================================================"<<endl;
  30.     }
  31.     else
  32.         cout <<"Please Enter a number request between 0-9"<<endl;
  33.  
  34.  
  35.  
  36.  
  37. }
  38. //**********************************************************
  39.  
  40. void serveRequest(void)
  41. {
  42.     cout <<"Do the ServeRequest function"<<endl;
  43.     cout <<endl<<endl;
  44.     cout <<"Position Prior to Serve Operation: ... "<<endl;
  45.     cout <<"Direction Prior to Serve Operation: .. "<<endl;
  46.     cout <<"The Request was Served from the: ..... "<<endl;
  47.     cout <<"Track Number of Request: ............. "<<endl;
  48.     cout <<"Number of Request: ................... "<<endl;
  49.     cout <<"Position After Serve Operation: ...... "<<endl;
  50.     cout <<"Direction After Serve Operation: ..... "<<endl;
  51.     cout <<"============================================================================"<<endl;
  52.  
  53.    
  54.  
  55.    
  56.    
  57. }
  58. //**********************************************************
  59.  
  60. void printState(void)
  61. {
  62.     cout <<"Do the print state function"<<endl;
  63.     cout <<endl<<endl;
  64.     cout<<"Current Position: .............. "<<endl;
  65.     cout<<"Current Direction: ............. "<<endl;
  66.     cout<<"Current Queue: ................. "<<endl;
  67.     cout<<endl<<endl;
  68.     cout<<"Contents of FORWARD QUEUE:"<<endl;
  69.     cout<<endl<<endl;
  70.     cout<<"Contents of REVERSE QUEUE:"<<endl;
  71.  
  72.     cout <<"============================================================================"<<endl;
  73.  
  74. }
  75. //**********************************************************
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82. int main(void) {
  83.     bool user = true;
  84.     string commandUser;
  85.     int  trackNum, currentPosition,T;
  86.     T=0;
  87.    
  88.     pqItemType forward;
  89.     pqItemType reverse;
  90.     //itemClass item(int trackNum, int T);
  91.     //itemClass test1( 6, 3);
  92.    
  93.    
  94.     currentPosition=0;
  95.     cout << "WELCOME TO THE DISK SCHEDULER"<<endl;
  96.     cout << "THE COMMANDS AVAILABLE TO YOU ARE \"EnqRequest\", \"ServeRequest\", \"PrintState\", AND \"Quit\"\n";
  97.     cin >> commandUser;
  98.     std::transform(commandUser.begin(), commandUser.end(), commandUser.begin(), ::toupper);
  99.    
  100.     do{
  101.         if ( commandUser == "ENQREQUEST" )
  102.         {
  103.             enqRequest(trackNum,currentPosition,T);
  104.            
  105.            
  106.             cout << "THANK YOU FOR USING THE DISK SCHEDULER"<<endl;
  107.             cout << "THE COMMANDS AVAILABLE TO YOU ARE \"EnqRequest\", \"ServeRequest\", \"PrintState\", AND \"Quit\"\n";
  108.             cin >> commandUser ;
  109.             std::transform(commandUser.begin(), commandUser.end(), commandUser.begin(), ::toupper);
  110.         }
  111.        
  112.         else if ( commandUser == "SERVEREQUEST" )
  113.         {
  114.             serveRequest();
  115.            
  116.             cout << "THANK YOU FOR USING THE DISK SCHEDULER"<<endl;
  117.             cout << "THE COMMANDS AVAILABLE TO YOU ARE \"EnqRequest\", \"ServeRequest\", \"PrintState\", AND \"Quit\"\n";
  118.             cin >> commandUser ;
  119.             std::transform(commandUser.begin(), commandUser.end(), commandUser.begin(), ::toupper);
  120.            
  121.                    }
  122.         else if ( commandUser == "PRINTSTATE" )
  123.         {
  124.             printState();
  125.            
  126.             cout << "THANK YOU FOR USING THE DISK SCHEDULER"<<endl;
  127.             cout << "THE COMMANDS AVAILABLE TO YOU ARE \"EnqRequest\", \"ServeRequest\", \"PrintState\", AND \"Quit\"\n";
  128.             cin >> commandUser ;
  129.             std::transform(commandUser.begin(), commandUser.end(), commandUser.begin(), ::toupper);
  130.            
  131.         }
  132.        
  133.         else if (commandUser == "QUIT"){
  134.             cout << "Thank you!"<<endl;
  135.             cout <<"Good bye !!!"<<endl;
  136.             user = false;
  137.         }
  138.         else
  139.         {
  140.             cout << "Please, enter a command" << endl;
  141.             cin >> commandUser;
  142.             std::transform(commandUser.begin(), commandUser.end(), commandUser.begin(), ::toupper);
  143.         }
  144.    
  145.     }while (user);
  146.    
  147.    
  148.     return 0;
  149. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement