#include<iostream>
#include<stdlib.h>
using namespace std;
#define maxSize 100
void BubbleSort(int R[],int n)
{
int i,j;
int temp;
for(i=n-1; i>=1; --i)
{
for(int j=1; j<=i; ++j)
if(R[j-1]>R[j])
{
temp=R[j];
R[j]=R[j-1];
R[j-1]=temp;
}
}
}
int main()
{
int R[maxSize];
int n=10;
for(int i=0; i<n; i++)
{
R[i]=rand()%11;
}
// int n=10;
// int R[n]={2,4,6,8,0,5,5,7,9,9};
cout<<"before sorting:"<<endl;
for(int i=0; i<n; i++)
cout<<R[i]<<"\t";
cout<<endl;
BubbleSort(R,n);
cout<<"after sorting:"<<endl;
for(int i=0; i<n; i++)
cout<<R[i]<<"\t";
}