Question: #include #include #include #include using namespace std; //functions for reading employee detais and second for showing employee details and third for deleting employee account. void

#include #include #include #include

using namespace std;

//functions for reading employee detais and second for showing employee details and third for deleting employee account.

void ReadEmployee(void); void ShowEmployee(void); void DeleteEmployeeAccount(void);

//template to store employee and account records. class Account{ public: int acc_no; float balance; };

//class declares its data member and its constructor under the scope identifier public. class Employee{ public: //pointer of account class Account * a; char designation[50]; char name[50]; //variable for taking input from user. float salary; public: //constructor Employee() { a=new Account; } };

//Function to take input employee records to store emploee and account records. void ReadEmployee() { Employee e1; //static variable remains unchanged through the lifetime of the program. int static_AccNo=1000; //for loop reads employee records and inserts them into vector. for(int i=0;i<2;i++) { cout << "Employee Name:: "; cin >> e1.name; cout << "Employee designamtion:: "; cin >> e1.designation; cout << "Employee Salary:: "; cin >> e1.salary; Account * ea =new Account; ea->acc_no=static_AccNo++; //Calculates the balance by using the standard formula. ea->balance=e1.salary/12; e1.a=ea; //Inserts the Employee records into the vector. EmployeeVector.push_back(e1); } } //Function to show employee records void ShowEmployee() { for(it1=EmployeeVector.begin();it1) { cout << " Name::" <name; cout << "::Balance::"balance; } } //Function to delete employee accounts void DeleteEmployeeAccount(void) { cout << " Deleting Employee Accounts.... "; for(it1=EmployeeVector.begin();it1 { Account * Temp_account=it1->a; //Sets the Account of employees inside vector to NULL. it1->a=NULL; delete Temp_account; cout << " Deleted Accout of" <name; } } int main(void) { ReadEmployee(); ShowEmployee(); DeleteEmployeeAccount(); return 0; }

I can't get it to compile, its from problem PE7.4 of Big C++ 2nd edition.

(program takes the employee records, displays the records and deletes the Accounts of employees.)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!