C++ Program – Bubble Sort Salary

by Nideesh C on May 2, 2011 · 1 comment

in C++




//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 Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. Sample – Program to enter salary and output income tax and net salary.
  2. C++ Program – BUBBLE SELECTION SORT
  3. C program to create a file called emp.rec and store information about a person, in terms of his name, age and salary.
  4. C Program to find the gross and net salary
  5. C++ program to implement Shell sort using class

{ 1 comment… read it below or add one }

1 Dewey Equiluz May 28, 2011 at 2:38 am

C++ Program – Bubble Sort Salary — Good keep it up..

Reply

Leave a Comment

Previous post:

Next post: