TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Bubble Sort program in C++
Muhammad Hassaan Mahmood
Nov 20
2014
Code
1.9
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
#include <iostream.h>
#include <conio.h>
void
main()
{
clrscr();
int
h,m,n;
int
a[6]={50,40,45,90,35,70};
for
(
int
k=0;k<=4;k++){
cout<<
"Phase No. "
<<k+1<<
"Starts from here : "
;
for
(
int
j=0;j<=4;j++)
{
for
(
int
p=j;p<=j;p++)
{ h=a[j];n=a[j+1];
if
(a[j]>a[j+1])
{ a[j+1]=h;
a[j]=n;}}
for
(
int
i=0;i<=5;i++)
cout<<a[i];
cout<<endl;
} }
getch();
}
Bubble Sort
Sorting
Algorithms