Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C + + Arrays of Structure Pointers and Dynamic Memory Allocation. Define a structure called Contact with two string members: name and phoneNumber.Write a sort

C++ Arrays of Structure Pointers and Dynamic Memory Allocation.
Define a structure called Contact with two string members: name and phoneNumber.Write a sort function that takes a Contact pointer and size of Contacts and sorts the Contacts pointed to by the pointer in ascending order based on the Contact names.Write a binary search function that takes a Contact pointer, size of Contacts and a name and searches for the Contact name. The function must return the index where the contact was found or -1, if not found.In main, ask the user how many Contacts to create and then dynamically allocate an array of Contacts of the specified size. Then, read that many names and phone numbers and store them in the Contacts array dynamically allocated.Sort the contacts by name using the sort function and display all contacts: names and phone numbers. Then, read a name from the user and using the binary search function search for it and then print in main the name and phone number of the search contact, if found or that it was not found.Delete the Contacts dynamically created when done.
4 Jack Spears 818-259-9854 Diego Guzman 213-546-1958 Lily Manning 818-459-1022 Jane Levan 213-459-2344 Jane LevanDiego Guzman 213-546-1958 Jack Spears 818-259-9854 Jane Levan 213-459-2344 Lily Manning 818-459-1022 Jane Levan 213-459-2344

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

More Books

Students also viewed these Databases questions

Question

=+How are the first copy costs and distribution costs comprised?

Answered: 1 week ago