­

Program in C++ to Search a no. Using (Bubble Sorting Method)

5:29 AM


use header files iostream.h and conio.h then

void main()
{ clrscr();
int a[100],i,n,j,temp;
cout<<"How many element: ";
cin>>n;
cout<<"Enter the elements of array: "<
for(i=0;i
cin>>a[i];
cout<<"The elements of array Before Sorting: "<
for(i=0;i
cout<
for(i=0;i
{
for(j=0;j
{
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}     }
cout<<"Elements of array After Sorting: "<
for(i=0;i
cout<
getch();}
Output:-
How many element: 3
Enter the elements of array:
5 4 9
The elements of array Before Sorting:
5 4 9
Elements of array After Sorting:
4 5 9

You Might Also Like

0 comments

Popular Posts

Like us on Facebook

Create your own banner at mybannermaker.com!

Flickr Images