Question: I need some help with my coding for my phone book project. Here are the instructions. Also, the instructor commented that my code should be

I need some help with my coding for my phone book project.

Here are the instructions. Also, the instructor commented that my code should be indented.

1) The code for the input portion of the program is to be in a function by itself. This function will add individuals and their telephone numbers to the appropriate arrays.

2) The code that sorts the arrays will be in a separate function. The function should take a parameter that indicates whether to sort ascending or descending.

3) The code for printing the data from the arrays will be in a separate function.

4) The code for searching for an individual in the arrays is to be in a separate function.

5) The program should give the user the following menu options:

a) Input data

b)Sort data Ascending

c) Sort data Descending

d) Print all data

e) Search for an individual in the data.

f) End program

The program will call the appropriate function based on user choice and the program will return to the menu afterwards (i.e. a perpetual loop). The program will only end when the user chooses End Program.

Here is my code:

#include

using namespace std;

int main()

{ cout << "Contact Manager" << endl;

int i,j,a;

string name[10],b,search;

int number[10];

cout<<" Enter the name and mobile numbers of 10 people";

for(i=0;i<10;i++)

{

cout<<" Enter the name"<

cin>>namename[i];

cout<<" Enter the phone number"<

cin>>number[i];

}

for (i = 0; i < 10; ++i)

{

for (j = i + 1; j < 10; ++j)

{

if (number[i] > number[j])

{

a = number[i];

number[i] = number[j];

number[j] = a;

b = name[i];

name[i] = name[j];

name[j] = b;

}

}

}

for(i=0;i<10;i++){

cout<<" "<

}

cout<<" Enter the name to search for";

cin>>search;

for(i=0;i<10;i++){

if(search==name[i]){

cout<<" "<

break;

}

else {

cout<<" Name could not be found";

}

}

}

THANK YOU!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!