void runFindTask(BinQueuePlusPlus &ourQueue){ cout<<endl; cout<<"**************************************************************"<<endl; cout<<"** Running Find Task **"<<endl; cout<<"**************************************************************"<<endl; cout<<endl; string answer; do{ string searchKey; //prompt user for key cout<<"Please enter a key to find: "; cin>>searchKey; cout<<"Searching for: " << searchKey <<endl; //check if key is in queue if(ourQueue.contains(searchKey)){ cout<< "The find function was successful!"<<endl; }else{ cout<< "The word entered does not exist the database!"<<endl; } cout<<"To search again enter 'y' else hit any key: "; cin>>answer; cout<<endl; }while(answer[0] == 'y' || answer[0] == 'Y'); cout<<"Find Task has ended..." <<endl; }
void runRemoveTask(BinQueuePlusPlus& ourTree) { cout<<endl; cout<<"**************************************************************"<<endl; cout<<"** Running Remove Task **"<<endl; cout<<"**************************************************************"<<endl; cout<<endl; string input; for(int i = 1; i<=5; i++){ //prompt user for key cout<<i<<") Please enter a key for removal: "; cin>>input; //check if key is in queue if (ourTree.contains(input) == false) { cout<<"KEY : "<<input<<" does not exist in queue"<<endl; } else{ //check if the remove was successful if(ourTree.remove(input)) cout<<"KEY : "<<input<<" : checked & successfully deleted"<<endl; else cout<<"unsuccessful removal"<<endl; } cout<<endl; }//end loop cout<<"Remove Task has ended..." <<endl; }