/*------------------------------------------- * File name: drive.cpp * Author: Xiannong Meng * Date: April 2, 1997 * Assignment: Classroom demonstration * Problem statement: This is a drive program to test the design * and implementation of function template 'SelectSort'. * We first generate an array, then sort it using 'SelectSort'. *------------------------------------------- */ #include #include #include "selsort.tem" // SelectSort function template #include "array.tem" // other array operations template void Test(int size, T ary[]) { GenArray(size, ary); // generate a random array SelectSort(size, ary); // sort the integer array using template PrintArray(size, ary); // print the array } void main(void) { int a[10]; // an integer array char b[10]; // a char array double c[10]; // a double array int size = 10; // and its size Test(size,a); // testing integers Test(size,b); // testing characters Test(size,c); // testing doubles }