Académique Documents
Professionnel Documents
Culture Documents
ALGORITHIM:heighst( )
step 1:- Read the array of object of employee
step 2:- Take the i/p i,j,val= emp[0].salary.
step 3:- Start for loop ( i=1 to 5 by 1)
step 4:check if(val<emp[i].salary) then goto step6
step 5:- val=emp[i].salary;
step 6:- Start for loop ( j=0 to5 by 1)
step 7:- check if(val==emp[j].salary) and print followings
step 8:-emp[j].name;
step 9:-emp[j].em_id;
step 10:- emp[j].salary;
Program Code:#include<iostream>
using namespace std;
class employee
{
private:
int salary;
int em_id;
char name[50];
public:
void insert();
void display();
friend void heighst(employee emp[]);
};
void employee::insert()
{
cout<<"\nenter the name";
cin>>name;
cout<<"\nenter the id";
cin>>em_id;
cout<<"\nenter the salary";
cin>>salary;
}
void employee::display()
{
}
int main()
{
employee emp[5],emp1;
for(int i=0;i<5;i++)
{
emp[i].insert();
}
for(int j=0;j<5;j++)
{
emp[j].display();
}
heighst(emp);
}
DISCUSSION:-