Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Any idea on how to do the flowchart for this C++ program? tqsm.

#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 searchContact(string name){ if(root == NULL){ cout<<"No data found!"<name == name){ cout<number<next; } } void deleteContact(string name){ if(root == NULL){ cout<<"No data found!"<next != NULL){ if(temp->next->name == name){ temp->next = temp->next->next; return; } temp = temp->next; } } void displayContact(){ if(root == NULL){ cout<<"No data found!"<name<<", Contact: "<number<next; } } }; int main() { BST *bst = new BST(); char ch; do{ int op; cout<<"Menu:"<>op; switch(op){ case 1:{ string name; long long number; cout<<"Enter name: "; cin>>name; cout<<"Enter number: "; cin>>number; node *contact = new node(); contact->name = name; contact->number = number; bst->addContact(contact); cout<<"Contact added"<displayContact(); break; } case 3:{ string name; cout<<"Enter name: "; cin>>name; bst->searchContact(name); break; } case 4:{ string name; cout<<"Enter name: "; cin>>name; bst->deleteContact(name); break; } } cout<<"Do you want to use more(Y/y): "; cin.ignore(); cin>>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

Relational Database And SQL

Authors: Lucy Scott

3rd Edition

1087899699, 978-1087899695

More Books

Students also viewed these Databases questions

Question

8. Explain competency models and the process used to develop them.

Answered: 1 week ago