// File: t-quick2.C // Test the Quicksort routines version 2 #include #include #include "array.h" #include "sorts.h" main(int argc, char *argv[]) { int size=0, seed=0 ; if (argc != 3) { cerr << "Usage: t-quick size seed" << endl ; exit(1) ; } size = atoi(argv[1]) ; seed = atoi(argv[2]) ; if (size <= 0 || seed <= 0) { cerr << "Bad size or seed" << endl ; exit(1) ; } Array A(size, seed) ; // Initialize to be already sorted // for (int i = 0 ; i < size ; i++) { A[i] = i ; } QuickSort(A) ; #ifndef NDEBUG if (!A.check()) { cout << "Sorting routine INCORRECT!" << endl ; } A.print() ; #endif }