Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please solve this as fast as you can. Provide all copyable code in C++ Make sure

ID: 3702723 • Letter: P

Question

Please solve this as fast as you can.

Provide all copyable code in C++

Make sure to make appropiate names for the .cpp and .h files, in order to know what each file code is for.

Project: Requirements We want to construct an Electronic Address Book, that will maintain the "contacts" of a user. A contact can be a person or a company. Each contact will be identified by its name Initially, each contact will have phone numbers, e-mail addresses, and website addresses. More information may be added to each contact. The address book's information will be stored in a file.

Explanation / Answer

The class and the member function is as follows.

#include <iostream>
#include <string>

class Address
{
friend std::istream &read(std::istream &is, Address addressbook[200]);
friend std::ostream &print(std::ostream &os, const Address addressbook[200]);

private:
std::string name;
std::string contact;
std::string emailaddress;
};
std::istream &read(std::istream &is,Address addressbook[200]) {
for (int i = 0; i < 10; i++)//the user can specify any condition
{
is >> addressbook[i].name; // get name
std::getline(is,addressbook[i].contact); // get contact details from input
std::getline(is,addressbook[i].emailaddress);
}
return is;
}

std::ostream &print(std::ostream &os, const Address addressbook[200]) {
for (int i = 0; i < 10; i++) {
os << "Name of the person: " << addressbook[i].name << std::endl << "contact: "
<< addressbook[i].contact << std::endl<<"Email-address:"<<addressbook[i].emailaddress << std::endl;
}
return os;
}

The coding for the main function is as follows

#include <iostream>
#include "Address.h"
int main() {

Address addressbook[200];

std::cout << "Enter name, and then the contact details: " << std::endl;
read(std::cin,addressbook);

print(std::cout, addressbook); //print the address book content

system("pause");
}