Bubble Sorting
#include <conio.h>
#include<iostream.h>
void inarry(int arry[],int size)
{
cout<<"enter the element of Arry"<<endl;
int e;
for(e=0;e<size;e++)
{
cin>>arry[e];
}
}
int main ()
{
cout<<" <<<<<<< Bubble Sorting >>>>>>>"<<endl<<endl;
int size;
cout<<"enter the size of arry"<<endl;
cin>>size;
int a[size],e,temp,j;
inarry(a,size);
for(j=0;j<size;j++)
{
for(e=0;e<size-1;e++)
{
if(a[e]>a[e+1])
{
temp=a[e];
a[e]=a[e+1];
a[e+1]=temp;
}
}
}
cout<<"Arrange Arry is "<<endl;
for(e=0;e<size;e++)
{
cout<<a[e]<<endl;
}
}
#include<iostream.h>
void inarry(int arry[],int size)
{
cout<<"enter the element of Arry"<<endl;
int e;
for(e=0;e<size;e++)
{
cin>>arry[e];
}
}
int main ()
{
cout<<" <<<<<<< Bubble Sorting >>>>>>>"<<endl<<endl;
int size;
cout<<"enter the size of arry"<<endl;
cin>>size;
int a[size],e,temp,j;
inarry(a,size);
for(j=0;j<size;j++)
{
for(e=0;e<size-1;e++)
{
if(a[e]>a[e+1])
{
temp=a[e];
a[e]=a[e+1];
a[e+1]=temp;
}
}
}
cout<<"Arrange Arry is "<<endl;
for(e=0;e<size;e++)
{
cout<<a[e]<<endl;
}
}
<<< >>>
0 comments:
Post a Comment