Question: Any idea on how to do the flowchart for this coding? C++ #include using namespace std; class node{ public: string name; long long number; node

Any idea on how to do the flowchart for this coding? C++Any idea on how to do the flowchart for this coding? C++

#include using namespace std; class node{ public: string name; long long number; node *next; }; class BST{ public: node *root; BST(){ root = NULL; } void addContact(node * contact){ if(root == NULL) { root = contact; return; } node *temp = root; while(temp->next != NULL){ temp = temp->next; } temp->next = contact; } void search Contact(string name){ if(root == NULL) { coutname == name){ coutnumbernext; } } void delete Contact(string name){ if(root == NULL) { coutnext != NULL) { if(temp->next->name == name) { temp->next = temp->next->next; return; } temp = temp->next; } } void displayContact(){ if(root == NULL) { coutnamenumbernext; } }; int main() { BST *bst = new BST(); char ch; do{ int op; cout>op; switch(op){ case 1:{ string name; long long number; cout>name; cout>number; node *contact = new node(); contact->name = name; contact->number = number; bst->addContact(contact); coutdisplayContact(); break; } case 3:{ string name; cout>name; bst->search Contact(name); break; } case 4:{ string name; cout>name; bst->delete Contact(name); break; } } cout>ch; }while(ch == 'Y' || ch == 'y'); return 0; } #include using namespace std; class node{ public: string name; long long number; node *next; }; class BST{ public: node *root; BST(){ root = NULL; } void addContact(node * contact){ if(root == NULL) { root = contact; return; } node *temp = root; while(temp->next != NULL){ temp = temp->next; } temp->next = contact; } void search Contact(string name){ if(root == NULL) { coutname == name){ coutnumbernext; } } void delete Contact(string name){ if(root == NULL) { coutnext != NULL) { if(temp->next->name == name) { temp->next = temp->next->next; return; } temp = temp->next; } } void displayContact(){ if(root == NULL) { coutnamenumbernext; } }; int main() { BST *bst = new BST(); char ch; do{ int op; cout>op; switch(op){ case 1:{ string name; long long number; cout>name; cout>number; node *contact = new node(); contact->name = name; contact->number = number; bst->addContact(contact); coutdisplayContact(); break; } case 3:{ string name; cout>name; bst->search Contact(name); break; } case 4:{ string name; cout>name; bst->delete Contact(name); break; } } cout>ch; }while(ch == 'Y' || ch == 'y'); return 0; }

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!