Please provide a paragraph form pseudocode for the source code below. #include <
ID: 3746602 • Letter: P
Question
Please provide a paragraph form pseudocode for the source code below. #include <iostream> #include <cstring> #include <algorithm> using namespace std; bool lower_test (char l, char r) { return (std::tolower(l) == std::tolower(r)); } bool searchName(string names[], int len, string searchName) { bool found = false; for(int i=0; i<len; i++) { if(search(names[i].begin(), names[i].end(), searchName.begin(), searchName.end(), lower_test) != names[i].end()) { cout << "found at: " << names[i] << endl; found = true; } } return found; } int main() { string names[] = { "Renee Javens, 678-1223", "Joe Looney, 586-0097", "Geri Palmer, 223-8787", "Lynn Presnell, 887-1212", "Bill Wolfe, 223-8878", "Sam Wiggins, 486-0998", "Bob Kain, 586-8712", "Tim Haynes, 586-7676", "John Johnson, 223-9037", "Jean James, 678-4939", "Ron Palmer, 486-2783" }; int count = 11; string search; cout << "Enter search string: "; cin >> search; if(!searchName(names, count, search)) { cout << "No name found." << endl; } }
Explanation / Answer
begin
Assign array of string names to array variable names
Intitalize count with 0
Accept the search element from the user
In if statement call the search function as if(!searchName(names, count, search) to find name
In function definition assign bool found as false
for i=0 to len do
change found = true
end if
end for
At last return true or false
if false do
print No name found
end if
endd program
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.