Question: Modular Design: ***please Help me to Fix may main menu** fixing my main() to using functions. there should at least be a couple of functions

Modular Design:

***please Help me to Fix may main menu**

fixing my main() to using functions. there should at least be a couple of functions here to process the ProgrammingProject object.

int main() { // declare a variable of type linked list LinkedList myList;

// declare other variables char choice; char n;

// let the user know about the program cout << " \tA program to demonstrate LinkedList class.";

// print a list of choices to the user do { cout<<" \t\tMENU "; cout << " \tAppend a node\t : A"; cout << " \tInsert a node\t : I"; cout<<" \tInsert a node At : P"; cout << " \tDelete a node\t : D"; cout<<" \tRemove node At\t : T"; cout<<" \tSearch a node\t : S"; cout<< " \tReverse nodes : R"; cout << " \tQuit \t : Q";

// prompt and read the user's choice. cout << " \tEnter your choice: "; cin >> choice;

//do appropriate action basing on choice selected. switch ( choice ) { case 'A' : case 'a' : // prompt and read an character. cout<<"\tEnter an character: "; cin >> n; // append the number into list. myList.appendNode( n ); break;

case 'I' : case 'i' : // prompt and read an character. cout<<"\tEnter an character: "; cin >> n; // insert the number into list. myList.insertNode( n ); break;

case 'D' : case 'd' : // prompt and read an character. cout <<"\tEnter an character : "; cin >> n; // delete the number from list. myList.deleteNode( n ); break; case 'R': case 'r': //Reversing nodes of list. myList.Reverse(); break; case 'T': case 't': int pos; //prompt a character to search. cout<<"\tEnter element position to be deleted:"; cin>>pos; myList.deleteAt(pos); break;

case 'S': case 's': int position; //prompt a character to search. cout<<"Enter element to be searched:"; cin>>n; //Search element. position=myList.Search(n); if(position ==-1) cout<<"\tElement not found in the list"<> n; //prompt a integer to search. cout<<"\tEnter position to be inserted:"; cin>>Loc; myList.insertNodeAt(n,Loc); break; case 'Q' : case 'q' : choice = 'q'; } // end switch

} while ( choice != 'q' ); // end do-while

return 0; // indicate program executed successfully } // end of function, ma

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!