![]() |
| ||
| A problem with classes Create a class; employee with 22 employees (permanent, temporaly) Class members: First name, IDno, Age, Depertment, salary,No of days, Gender, Marital status. Class function members are: capturenewemployee(), Displayemployeedetails(), Searchemployee(). |
| ||
| Re: A problem with classes hi try this one #include<iostream> using namespace std; class employee { int Id_no,No_days,age; float salary; char first_name[5],depat[5],gen[4],material[6]; public: void capturenewemployee(); void employeedetails(); void searchemployee(); }; void employee :: capturenewemployee(void) { cout << "enter the firstname" << "\n" ; cin >> first_name ; cout << " enter age " << "\n" ; cin >> age; cout << " enter the Id_no" << "\n" ; cin >> Id_no ; cout << " enter the department " << "\n" ; cin >> depat ; cout <<" enter the gender" << "\n" ; cin >> gen ; cout << " enter material status" << "\n" ; cin >> material ; cout << " enter the No_days " << "\n" ; cin >> No_days; cout << " enter the salary" << "\n"; cin >> salary ; } void employee :: employeedetails(void) { cout <<" display result" << "\n"; cout << first_name << "\n"; cout << age << "\n"; cout << Id_no << "\n"; cout << depat << "\n"; cout << gen << "\n"; cout << material << "\n"; cout << No_days << "\n"; cout << salary << "\n"; } void employee :: searchemployee(void) { cout <<" search result"<< "\n"; cout << first_name << "\n"; cout << age << "\n"; cout << Id_no << "\n"; cout << depat << "\n"; cout << gen << "\n"; cout << material << "\n"; cout << No_days << "\n"; cout << salary << "\n"; } int main() { employee ne[10],ol[10];int i; for(i=0;i<3;i++) { cout <<"enter employee details" << "\n"; ne[i].capturenewemployee(); } ne[0].employeedetails(); ne[2].searchemployee(); return 0; } |
| All times are GMT -4. The time now is 2:53 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC