Sunday, August 12, 2012

Bubble Sort In C++


#include
#include

void main()
{
int array[100],n,i,j,temp;
clrscr();
cout<<"Enter the length of Array--> ";
cin>>n;
cout<<"Enter "<
for(i=0;i
cin>>array[i];
for(i=0;i
{
for(j=0;j
if(array[j]>array[j+1])
{
temp=array[j];
array[j]=array[j+1];
array[j+1]=temp;
}
}
cout<<"\nArray is sorted in ascending order.\n";
for(i=0;i
cout<
getch();
}

No comments:

Post a Comment