#include <iostream>
using namespace std;
void BubbleSort(int r[],int n);
void Swap(int *a, int *b);
int main()
{
int a[10]={4,-3,2,8,-9,7,0,-6,5,-1};
for ( int i=0; i< 10; i++)
cout << a[i] << " ";
cout << endl;
BubbleSort(a,10);
for ( int i=0; i< 10; i++)
cout << a[i] << " ";
cout << endl;
return 0;
}
void BubbleSort(int r[],int n)
{
int i, j;
for (i = 0; i < n-1; i++ )
for ( j = 1; j <n - i; j++)
if(r[j - 1] > r[j])
Swap((r+j-1),(r+j));
}
void Swap(int *a, int *b)
{
int temp;
temp = *a;
*a = *b;
*b = temp;
}