c ty ty Create a struct named Entry that stores an entry of
c++ ty ty
Create a struct named Entry that stores an entry of an address book. It should have fields for first name, last name and email address. Provide the appropriate getter and setter functions for each one of the fields. In addition provide a function called print. This function should print out the information in the struct in the way it appears in the sample.
Your code should go into a file named Entry.h with all the member functions implemented inline (in the header file). Your code will be tested using the Entry.h with all the member functions implemented inline (in the header file).
sample input:
Joe
Soap
joe@yahoo.com
output:
First Name: Joe
Last Name: Soap
Email: joe@yahoo.com
Solution
#define ENTRY_H
#include <iostream>
#include <string>
using namespace std;
struct Entry {
string name, last, mail;
void setName(const string first_name){
name = first_name; }
void setLastName(const string last_name){
last = last_name; }
void setEmail(const string email){
mail = email; }
void print(){
cout<<\"First Name:\"<< name << endl;
cout<<\"Last Name:\"<< last << endl;
cout<<\"Email:\"<< mail << endl; }
};
#end if;
