| | |
A problem with classes
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
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 beginner binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets





