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
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::" <
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
Get step-by-step solutions from verified subject matter experts
