0% found this document useful (0 votes)
32 views4 pages

OOP Exp 7

Uploaded by

dhananjay mane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views4 pages

OOP Exp 7

Uploaded by

dhananjay mane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

EXP7.

1 Employee details having salary greater than 25000/-

#include<iostream.h>

class Employee

int emp_id;

char emp_name[20];

public:

float

emp_salary;

void accept()

cout<<"\nEnter Employee id=> ";

cin>>emp_id;

cout<<"Enter employee Name=> ";

cin>>emp_name;

cout<<"Enter employee salary=> ";

cin>>emp_salary;

}
void display()

cout<<endl<<"Employee id=> "<<emp_id<<endl;

cout<<"Employee NAme=> "<<emp_name<<endl;

cout<<"Employee Salary=> "<<emp_salary;

};

int main()

int i;

Employee e[5];

for(i=0;i<5;i++)

e[i].accept();

cout<<"Employees having Salary greater than 25000 are:\n";

for(i=0;i<5;i++)

if(e[i].emp_salary>25000)

e[i].display();

return 0;
}

EXP7.2 City and their population

#include<iostream.h>

class City

long int

population; char

city_name[20];

public:

void accept()

cout<<"\nEnter City Name=> ";

cin>>city_name;

cout<<"Enter Population of the City=> ";

cin>>population;

void display()

cout<<endl<<"City Name=>

"<<city_name<<endl;

cout<<"Population=> "<<population<<endl;

}
};

int main()

int i;

City c[10];

for(i=0;i<10;i++)

c[i].accept();

cout<<"\nCity details are:\n";

for(i=0;i<10;i++)

c[i].display();

return 0;

You might also like