| | |
A problem with classes
![]() |
•
•
Join Date: Oct 2008
Posts: 20
Reputation:
Solved Threads: 2
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;
}
#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;
}
![]() |
Similar Threads
- Classes which depend on each other? (C++)
- For loop problem (Java)
- problem with classes (C++)
- Python GUI Problem (Python)
- tomcat jsp problem (JSP)
- Passing arrays of objects to functions (C++)
- Help with Classes (C++)
- problem with my program!! (C++)
- TreeListView problem (C)
Other Threads in the C++ Forum
- Previous Thread: Problem in loading VC++ Win32 dll in C#
- Next Thread: Hiding the consol window in VC++ W32 consol app
| Thread Tools | Search this Thread |
api array based binary bitmap c++ c/c++ char class classes classified code coding compatible compile console conversion count date delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file filewrite forms fstream function functions game givemetehcodez graph gui homeworkhelp homeworkhelper homeworksolutions iamthwee icon if...else ifstream input int integer java lib linkedlist linker loop looping loops map math matrix memory multiple news node object output play pointer problem program programming project python random read recursion reference rpg string strings struct symbol temperature template test text text-file toolkit tree url values variable vector video win32 windows winsock wordfrequency wxwidgets





