// bubble.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "iostream.h"
#include "time.h"
#include "stdlib.h"

const N=10;

int i,j,s,temp,a[N],b[N], ind, flag;

void ShakerSort(int *a)
{
	ind=1;
	do
	{
	 flag=1;
	 i=ind;
	 for(j=N-1;j>i-1;j--)
	 if (a[j]<a[j-1]) 
	 {  
	   temp=a[j]; a[j]=a[j-1]; a[j-1]=temp;
	   flag=0;
	   ind=j;
	 } 
	}
	while (flag);
}
   
void Popalvane(int *a)
{
	srand((unsigned)time);
	for(i=0;i<N;i++)
	a[i]=rand();
}

void Show(int *a)
{
	for(i=0;i<N;i++)
		cout<<a[i]<<" ";
}

int main(int argc, char* argv[])
{
	Popalvane(a);
	ShakerSort(a);
	Show(a);
	cin>>i;
	return 0;
}
