Bubble Sort Method Which sort an array using bubble sort..........
void BubbleSrt(int A[10])
{
int i,j;
int temp;
for(i=0; i<10; i++)
{
for(j=i+1; j<10; j++)
{
if(A[i]>A[j])
{
temp=A[i];
A[i]=A[j];
A[j]=temp;
}
}
}
cout<<"Sorted values after bubble sort"<<endl;
for(i=0; i<10;i++)
{
cout<<A[i]<<"";
}
}
No comments:
Post a Comment