C++ Program: Bubble Sorting

This is a basic C++ Bubble Sort Program which I had to create in my college. It has Been posted here for reference.This code will only work in the obsolete Borland Turbo C++ v3  !!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream.h>
#include <conio.h>
void main()
{
clrscr();
int b[10];
cout << "Please enter 10 numbers" << endl;
for (int i = 0; i < 10; i++ )
cin >> b[i];

clrscr();

cout << "You have entered the foll numbers.:" << endl;
for (int j = 0; j < 10; j++ )
cout << b[j] << " ";

for (int k = 0; k < 10; k++ )
for (int n = 0; n < 9-k; n++ )
if (b[n] > b[n + 1])
{
int t = b[n + 1];
b[n + 1] = b[n];
b[n] = t;
}

cout << endl << "the nos have been arranged as follows" <<
endl;
for (int m = 0; m < 10; m++ )
cout << b[m] << " ";
getch();
}
  • http://www.gohost.in Web Hosting India

    Really excellent blog.. After a long time i have using this program.. Very useful blog.. Thanks for this one..

    • SAHIL

      Thank u…

      • http://www.gohost.in Web Hosting India

        Thanks a lot..

  • http://www.mactonweb.com web design bangalore

    Great tutorial you have describe well this very useful  information fantastic blog