The code is almost done but I still need to figure out how can I delete en element in Addressbook  ????? Would you read the code and try to compile it and see what I am missing    #include #include using namespace std; #define M 100 int count=0; struct AddressBook{      string FullName;      int Birthday;      string Address;      string Email;      int PhoneNumber;  } Person [M]; void add(); void browse(); void searchByName(); void searchByBirthday(); void removeContact(); void order(); int main(){     int choice;     do{         cout << "Please Enter Your Choise: \n";         cout << " 1-Add New Person\n 2-Browse\n 3- Search By Full Name              \n4- Search By Birthday 5- Remove a Person" << "\n6- Alphabetical             Order \n7-Exit\n";         cin >> choice;         switch(choice){             case 1: add();             case 2: browse();break;             case 3: searchByName();             case 4: searchByBirthday();             case 5: remove();             case 6: order(); break;             case 7: return 0;          }     }      while (count < M );      return 0; } void add(){     cout << "Person's Name:";cin>> Person[count].FullName;     cout << "Person's Birthday:";cin>>Person[count].Birthday;     cout << "Person's Address:";cin>>Person[count].Address;     cout << "Person's Email:";cin>>Person[count].Email;     cout << "Person's Phone Number:";cin>>Person[count].PhoneNumber;     count ++;     cout<<"\n"; } void browse(){      cout << "Name\n";      for(int i =0; i < count;i++)      cout << Person[i].FullName<<"\t"                                                                   <> FullName;       for(i=0;i> B;         for (i=0; i Person[j+1].FullName){                                   temp=Person[j];                                   Person[j]=Person[j+1];                                   Person[j+1]= temp;                            }                   }            }              cout << "\n";              out:browse(); }

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 10RQ
icon
Related questions
Question
 
The code is almost done but I still need to figure out how can I delete en element in Addressbook  ?????

Would you read the code and try to compile it and see what I am missing 

 


#include<iostream>
#include<string>
using namespace std;
#define M 100
int count=0;
struct AddressBook{
     string FullName;
     int Birthday;
     string Address;
     string Email;
     int PhoneNumber;
 }
Person [M];
void add();
void browse();
void searchByName();
void searchByBirthday();
void removeContact();
void order();
int main(){
    int choice;
    do{
        cout << "Please Enter Your Choise: \n";
        cout << " 1-Add New Person\n 2-Browse\n 3- Search By Full Name              \n4- Search By Birthday 5- Remove a Person" << "\n6- Alphabetical             Order \n7-Exit\n";
        cin >> choice;
        switch(choice){
            case 1: add();
            case 2: browse();break;
            case 3: searchByName();
            case 4: searchByBirthday();
            case 5: remove();
            case 6: order(); break;
            case 7: return 0;

         }
    }
     while (count < M );
     return 0;

}
void add(){
    cout << "Person's Name:";cin>> Person[count].FullName;
    cout << "Person's Birthday:";cin>>Person[count].Birthday;
    cout << "Person's Address:";cin>>Person[count].Address;
    cout << "Person's Email:";cin>>Person[count].Email;
    cout << "Person's Phone Number:";cin>>Person[count].PhoneNumber;
    count ++;
    cout<<"\n";
}
void browse(){
     cout << "Name\n";
     for(int i =0; i < count;i++)
     cout << Person[i].FullName<<"\t"                                                                   <<Person[i].Birthday<<"\t<<Person[i].Address<<"\t"                                     <<Person[i].Email<<"\t"<<Person[i].PhoneNumber<<"\t" <<"\n";
     cout<<"\n";

}
void searchByName(){
      string FullName;
      bool found = false;
      int i;
      cout << "Enter name:";cin >> FullName;
      for(i=0;i<count; i++){
           if (FullName == Person[i].FullName){
                  cout << Person[i].FullName<<"\t"<< Person[i].Birthday<<"\t"                       <<Person[i].Address<<"\t"<<Person[i].Email<<"\t"                                      <<Person[i].PhoneNumber<<"\t" <<"\n";
                   found = true;

            }
     }
       if(!found){
             cout << FullName << "was not found \n";
       }


}
void searchByBirthday() {

        int B;
        bool found = false;
        int i ;
        cout << " Enter Person's Birthday:"; cin >> B;
        for (i=0; i<count; i++){
                if (Person[i].Birthday==B){
                       cout << Person[i].FullName<<"\t"<<                                                              Person[i].Birthday<<"\t"<<Person[i].Address<<"\t"                                        <<Person[i].Email<<"\t"<<Person[i].PhoneNumber<<"\t"                            <<"\n";
                         found = true;
                 }
          }
           cout << "\n";
           if(!found){
                    cout << "No result\n";
           }

}
void remove(){

}
void order(){
         int i,j;
         AddressBook temp;
         if(count < 2) goto out;
         for(i=0; i<count; i++){
                for (j=0; j<count -1; j++){
                         if(Person[j].FullName > Person[j+1].FullName){
                                  temp=Person[j];
                                  Person[j]=Person[j+1];
                                  Person[j+1]= temp;
                           }
                  }
           }
             cout << "\n";
             out:browse();
}

Expert Solution
steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Knowledge Booster
Files and Directory
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT