Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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++image text in transcribed

#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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions

Question

Are you getting real respect? Or is it fear and contempt?

Answered: 1 week ago

Question

Solve for x: 2(3x 1)2(x + 5) = 12

Answered: 1 week ago

Question

=+j Describe the various support services delivered by IHR.

Answered: 1 week ago

Question

=+j Explain IHRMs role in global HR research.

Answered: 1 week ago

Question

=+j Describe an effective crisis management program.

Answered: 1 week ago