Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / I have a menu function like below and i add a pressEnter() function after each menu selected

I have a menu function like below and i add a pressEnter() function after each menu selected

Computer Science

I have a menu function like below and i add a pressEnter() function after each menu selected.   For menu other than findVehicle and parkVehicle, it is ok to for me to press enter and go to another line.  for that two function, after i need to press enter twice or i need to press a key and then an enter into go to new line.  Anything i need to in the function to avoid it?

 

 int Parking::run() {
 int selection = 0;
 bool complete = false;

 while (!isEmpty() && !complete) {
  parkStatus();
  parkingMenu.display();
  cin >> selection;
  if (selection == 1) {
   parkVehicle();
   pressEnter();
  }
  else if (selection == 2) {
   returnVehicle();
   pressEnter();
  }
  else if (selection == 3) {
   listParkedVehicle();
   pressEnter();
  } 
  else if (selection == 4) {
   findVehicle();
   pressEnter();
  }
  else if (selection == 5){
   complete = closeParking();
  }
  else if (selection == 6) {
   complete = exitParking();
  }
  
 }
 if (filename == nullptr) {
  return 1;
 }
 else {
  return 0;
 }
}

 

 void Parking::pressEnter() {
 cout << "Press <ENTER> to continue....";
 cin.get();
 cin.ignore();
}

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Related Questions