Pratik Bakane C++ programs...............This are programs desingedby sy diploma student from Governement Polytecnic Thane.....programsare very easy alongwith coding andscreen shot of the output
1. /*Program to declare a class staff having data members as name and
department. Accept data for 3 staffs and display name of the staff that
are in the IT department*/
#include<iostream.h>
#include<conio.h>
#include<string.h>
class staff
{
public:
char name[20],dept[20];
void accept()
{
cout<<"nnttEnter name : ";
cin>>name;
cout<<"nnttEnter department : ";
cin>>dept;
}
void display()
{
cout<<"nnttName : "<<name<<endl;
// cout<<"nnttDept : "<<dept<<endl;
}
2. };
void main()
{
int i;
clrscr();
staff s[3];
for(i=0;i<3;i++)
s[i].accept();
cout<<"********Member in IT department***************"<<endl;
for(i=0;i<10;i++)
{
if(strcmp(s[i].dept,"IT")==0)
s[i].display();
}
getch();
}