Trusted by Students Everywhere
Why Choose Us?
0% AI Guarantee

Human-written only.

24/7 Support

Anytime, anywhere.

Plagiarism Free

100% Original.

Expert Tutors

Masters & PhDs.

100% Confidential

Your privacy matters.

On-Time Delivery

Never miss a deadline.

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

Computer Science Apr 15, 2023

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();
}

Expert Solution

For detailed step-by-step solution, place custom order now.
Need this Answer?

This solution is not in the archive yet. Hire an expert to solve it for you.

Get a Quote
Secure Payment