//Downloaded From theonlinetutorials.com
//(C)2011.All rights reserved.
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
struct employee
{
int eno;
char name[25];
float salary;
}e[10];
void main()
{
clrscr();
int n;
void bubb(employee,int);
cout<<"Enter No of Employees"<<endl;
cin>>n;
for(int i=0;i<n;i++)
{
cout<<"Enter Employee Name :";
gets(e[i].name);
cout<<endl<<"Enter Employee Code :";
cin>>e[i].eno;
cout<<endl<<"Enter Employee Salary :";
cin>>e[i].salary;
}
bubb(e[10],n);
getch();
}
void bubb(employee e,int n)
{
employee x;
for(int j=0;j<n;j++)
{
if(e[j].salary<e[j+1].salary)
{
for(int i=j;i<n-1;i++)
{
x=e[i];
e[i]=e[i+1];
e[i+1]=x;
}
}
}
for(int i=0;i<n;i++)
{
cout<<endl;
cout<<e[i].name<<endl<<e[i].salary<<endl<<e[i].eno;
}
}
Not Satisfied ? Just search & get the result
Related posts:
- Sample – Program to enter salary and output income tax and net salary.
- C++ Program – BUBBLE SELECTION SORT
- C program to create a file called emp.rec and store information about a person, in terms of his name, age and salary.
- C Program to find the gross and net salary
- C++ program to implement Shell sort using class

{ 1 comment… read it below or add one }
C++ Program – Bubble Sort Salary — Good keep it up..