Question
C++ Programming How do I write a pseudocode and flowchart for this code #include #define SIZE 3 using namespace std; //Reads 3 people names and
C++ Programming
How do I write a pseudocode and flowchart for this code
#include
//Reads 3 people names and their phone numbers to directory. void readInput(string names[], string numbers[]) { cout > names[i]; cout > numbers[i]; } }
//Sorts the directory data based on telephone numbers, and input sort type. void sortDirectory(string names[], string numbers[], char sortType) { if(sortType == 'D') for(int i = 0; i 0) { string temp = numbers[j]; numbers[j] = numbers[j+1]; numbers[j+1] = temp; temp = names[j]; names[j] = names[j+1]; names[j+1] = temp; } } else cout
//Prints the list of names, and their associated numbers. void printDirectory(string names[], string numbers[]) { for(int i = 0; i
//Searches for specified name in the directory. void searchDirectory(string names[], string numbers[], string searchKey) { bool found = false; for(int i = 0; i > choice; switch(choice) { case 1: readInput(names, telephoneNumbers); break; case 2: sortDirectory(names, telephoneNumbers, 'A'); break; case 3: sortDirectory(names, telephoneNumbers, 'D'); break; case 4: printDirectory(names, telephoneNumbers); break; case 5: cout > name; searchDirectory(names, telephoneNumbers, name); break; case 6: return 0; default: cout
Enter your choice: 1 Enter the names and numbers of 3 people to save to directory. Name #1: James Telephone #: 6512395478 Name #2: John Telephone #: 7634567896 Name #3: Ricky Telephone #: 9561234569 1. Input Data 2. Sort Data Ascending 3. Sort Data Descending. 4. Print all Data 5. Search for individual. 6. Quit Enter your choice: 2 1. Input Data 2. Sort Data Ascending. 3. Sort Data Descending. 4. Print all Data 5. Search for individual. 6. Quit Enter your choice: 3 1. Input Data 2. Sort Data Ascending. 3. Sort Data Descending 4. Print all Data 5. Search for individual. 6. Quit Enter your choice: 4 Name: Ricky Name: John Name: ames Telephone: 9561234569 Telephone: 7634567896 Telephone: 6512395478 1. Input Data 2. Sort Data Ascending. 3. Sort Data Descending. 4. Print all Data 5. Search for individual. 6. Quit Enter your choice: 5 Enter the name to search for: Tony User cannot be found. 1. Input Data 2. Sort Data Ascending. 3. Sort Data Descending. 4. Print all Data 5. Search for individual. 6. Quit Enter your choice: 6 Exit code: 0 (normal program termination) Enter your choice: 1 Enter the names and numbers of 3 people to save to directory. Name #1: James Telephone #: 6512395478 Name #2: John Telephone #: 7634567896 Name #3: Ricky Telephone #: 9561234569 1. Input Data 2. Sort Data Ascending 3. Sort Data Descending. 4. Print all Data 5. Search for individual. 6. Quit Enter your choice: 2 1. Input Data 2. Sort Data Ascending. 3. Sort Data Descending. 4. Print all Data 5. Search for individual. 6. Quit Enter your choice: 3 1. Input Data 2. Sort Data Ascending. 3. Sort Data Descending 4. Print all Data 5. Search for individual. 6. Quit Enter your choice: 4 Name: Ricky Name: John Name: ames Telephone: 9561234569 Telephone: 7634567896 Telephone: 6512395478 1. Input Data 2. Sort Data Ascending. 3. Sort Data Descending. 4. Print all Data 5. Search for individual. 6. Quit Enter your choice: 5 Enter the name to search for: Tony User cannot be found. 1. Input Data 2. Sort Data Ascending. 3. Sort Data Descending. 4. Print all Data 5. Search for individual. 6. Quit Enter your choice: 6 Exit code: 0 (normal program termination)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started