// File: bubblemain.C
//
// Using the bubble sort template to sort integers, floating point numbers
// and fractions.

#include <iostream.h>
#include "fraction.h"
#include "bubble.h"

main() {

   // Initialize a couple of arrays for sorting
   int A[] = {5, 7, 9, 2, 1, 4, 3, 6, 8, 0} ;
   float B[] = {1.5, 1.7, 1.9, 1.2, 1.1, 1.4, 1.3, 1.6, 1.8, 1.0} ;
   Fraction C[] = {
	  Fraction(15,10), Fraction(17,10), Fraction(19,10),
	  Fraction(12,10), Fraction(11,10), Fraction(14,10),
	  Fraction(13,10), Fraction(16,10), Fraction(18,10), Fraction(10,10) } ;

   int i ;

   cout << "\nThe array A[]: \n" ;
   for (i = 0 ; i < 10 ; i++) {
	  cout << "   A[" << i << "] = " << A[i] << "\n" ;
   }

   BubbleSort(A,10) ;

   cout << "\nThe array A[] after sorting: \n" ;
   for (i = 0 ; i < 10 ; i++) {
	  cout << "   A[" << i << "] = " << A[i] << "\n" ;
   }

   cout << "\nThe array B[]: \n" ;
   for (i = 0 ; i < 10 ; i++) {
	  cout << "   B[" << i << "] = " << B[i] << "\n" ;
   }

   BubbleSort(B,10) ;

   cout << "\nThe array B[] after sorting: \n" ;
   for (i = 0 ; i < 10 ; i++) {
	  cout << "   B[" << i << "] = " << B[i] << "\n" ;
   }

   cout << "\nThe array C[]: \n" ;

   for (i = 0 ; i < 10 ; i++) {
	  cout << "   C[" << i << "] = " << C[i] << "\n" ;
   }

   BubbleSort(C,10) ;

   cout << "\nThe array C[] after sorting: \n" ;
   for (i = 0 ; i < 10 ; i++) {
	  cout << "   C[" << i << "] = " << C[i] << "\n" ;
   }
}
