//BCA Support
//www.bcasupport.xyz
#include <iostream.h>
#include <conio.h>
template <class t>
void bubble(t num[])
{
for(a=0;pass<9;pass++)
{
for(b=a+1;b<(10-pass);)
{
if(num[b]<num[a])
{
temp=num[a];
num[a]=num[b];
num[b]=temp;
}
a=b;
b=a+1;
}
a=0;
}
}
int a,b,temp,pass=0;
int main()
{
clrscr();
int num[10];
cout<<"\nEnter 10 numbers :\n";
for(a=0;a<10;a++)
cin>>num[a];
bubble(num);
cout<<"\nSorted list :";
for(a=0;a<10;a++)
cout<<endl<<num[a];
getch();
return 0;
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.