At the end of the switch statement, I want to prompt the user to enter another input that will be checked again in the switch statement. How can I reloop the new user input to the switch statement?
switch(choice){
case 'l' :
ct.Start();
count = LinearSearch(new_books, requested_books);
ct.Stop();
break;
case 'b' :
ct.Start();
Sort(new_books, requested_books);
count = BinarySearch(new_books, requested_books);
ct.Stop();
break;
case 'r' :
ct.Start();
Sort(new_books, requested_books);
count = RecursiveBinarySearch(new_books, requested_books);
ct.Stop();
break;
default :
std::cout << "Incorrect choice\n";
std::cout << "Choice of search method ([l]inear, [b]inary, [r]recursiveBinary)?";
std::cin >> choice; //do I need to run some sort of while loop here?
}
I imagine I have to wrap the switch statement in a while loop, but I have no idea how it would work