Docsity

C++ Program to Implement Bubble Sort Algorithm, Exercises of Data Structures and Algorithms

Partial preview of the text

Download C++ Program to Implement Bubble Sort Algorithm and more Exercises Data Structures and Algorithms in PDF only on Docsity!

#include<iostream.h> #include<conio.h> void main (void) { int a[10]={3,4,51,8,5,45,7,0,9,11}; int i,j,b; clrscr(); for (i=0;i<=10;i++) for (j=i+1;j<10;j++) { if (a[i]>=a[j]) { b=a[i]; a[i]=a[j]; a[j]=b; } } for (i=0;i<10;i++) { cout<<" "<<a[i]; } getch(); }

docsity.com