© 2014 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu
Quick Links
Easy Studies


CPP Program To Implement Bubble Sort :

#include #include class BubbleSort { int a[25],len; public: void getdata(); void bubblesort(); void display(); }; void BubbleSort :: getdata() { cout<>len; cout<>a[i]; } void BubbleSort :: bubblesort() { int k,temp; cout<"<<"("<a[j]) { temp=a[i]; a[i]=a[j]; a[j]=temp; } } for(k=0;k

SAMPLE INPUT AND OUTPUT:
  Enter how many elements you want to sort

5

Enter the numbers
5
4
3
2
1

PASS->1  1 5 4 3 2
PASS->2  1 2 5 4 3
PASS->3  1 2 3 5 4
PASS->4  1 2 3 4 5

Final sorted list is 1 2 3 4 5

 
SLogix Student Projects

⇓Student Projects⇓
⇑Student Projects⇑
bottom