Subscribe to Feeds

Send Your COMPLETED Projects To georgepj@hotmail.com

We'll Publish It With Your Name :-)

Programs Can Also Be Downloaded From The Folders Below....[Or Scroll Down]

Salary Sort

Click Here To Download C++ File Of This Program
 //SALARY ORDER  
//Downloaded From www.c4cpp.co.nr
//(C)2009.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;
}
}

No comments: