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

Using c++ language to write the following : Create a structure to hold informati

ID: 3718983 • Letter: U

Question

Using c++ language to write the following :

Create a structure to hold information about an Employee. Create fields to hold first and last name, hire date, a code indicating whether the employee works ('w') or is a supervisor ('s'), and a field for yearly salary. I DON'T KNOW WHAT BOLD WORDS MEAN.

Here the code I did.

struct Employee{

string firstName, lastName;

string hireDate;

int employeeCode;

int year_Salary;

} ;

// function

Employee getEmp(){

Employee e;

cout << " Enter first name: " ;

getline(cin,e.firstName);

cout << " Enter last name: " ;

getline(cin, e.lastName);

cout << " Enter hire date:" ;

getline(cin, e.hireDate);

cout << " Enter employee code: ";

cin >> e.employeeCode;

cin.ignore();

cout << " Enter yearly salary: ";

cin >> e.year_Salary;

cin.ignore();

return(e);

}

And then convert the function as follow

write the getEmp function using a pointer or reference parameter to return the structure

Explanation / Answer

struct Employee{

string firstName, lastName;

string hireDate;

int employeeCode;

int year_Salary;

} ;

// function

Employee* getEmp(){

Employee e* = new Employee;

cout << " Enter first name: " ;

getline(cin,e->firstName);

cout << " Enter last name: " ;

getline(cin, e->lastName);

cout << " Enter hire date:" ;

getline(cin, e->hireDate);

cout << " Enter employee code: ";

cin >> e->employeeCode;

cin.ignore();

cout << " Enter yearly salary: ";

cin >> e->year_Salary;

cin.ignore();

return (e);

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote