Answer to Question #303035 in C++ for Norri

Question #303035

Pls help me to implement this program





#include <iostream>



using namespace





struct NameType



{





string first;



string middle;



string last;





};





struct AddressType



{





string address1;



string address2;



string city;



string state;



string zip;





};





struct DateType



{





int month;



int day;



int year;





};





struct ContactType



{





string phone;



string cellphone;



string fax;



string pager;



string email;





};





struct EmployeeType



{





NameType name;



string emp_id;



AddressType address;



DateType hireDate;



DateType quitDate;



ContactType contact;





};




1
Expert's answer
2022-02-27T04:12:10-0500
#include <iostream>
using namespace std;


#define NO_OF_EMP	3


struct NameType
{
	string first;
	string middle;
	string last;
};


struct AddressType
{
	string address1;
	string address2;
	string city;
	string state;
	string zip;
};


struct DateType
{
	int month;
	int day;
	int year;
};


struct ContactType
{
	string phone;
	string cellphone;
	string fax;
	string pager;
	string email;
};


struct EmployeeType
{
	NameType name;
	string emp_id;
	AddressType address;
	DateType hireDate;
	DateType quitDate;
	ContactType contact;
};


int main()
{
	int n=0;
	struct EmployeeType E[NO_OF_EMP];


	E[n].name.first  = "abc";
	E[n].name.middle = "lmn";
	E[n].name.last   = "xyz";


	E[n].emp_id      = "1234";
	
	E[n].address.address1 = "A1";
	E[n].address.address2 = "A2";
	E[n].address.city     = "C1";
	E[n].address.state    = "S1";
	E[n].address.zip      = "123456";
	
	E[n].hireDate.day     = "26";
	E[n].hireDate.month   = "02";
	E[n].hireDate.year    = "2020";
	
	E[n].quitDate.day     = "26";
	E[n].quitDate.month   = "02";
	E[n].quitDate.year    = "2020";
	
	E[n].contact.cellphone="1234567890";
	E[n].contact.email    ="abc@gmail.com";
	E[n].contact.fax      ="1234567890";
	E[n].contact.pager    ="1234567890";
	E[n].contact.phone    ="1234567890";
	
	return(0);
	
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog