Answered step by step
Verified Expert Solution
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 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.
Jack Spears Diego Guzman Lily Manning Jane Levan Jane LevanDiego Guzman Jack Spears Jane Levan Lily Manning Jane Levan
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