/***************************************************************************** File: hilo.cpp Author: Keith Alcock Comment: Finds the high and low values in a vector ****************************************************************************** Revision control system and include for self *****************************************************************************/ char *PVCS_HILO_c= "@(#)$Workfile: hilo.cpp$\n" "@(#)$Revision: 5$\n" "@(#) $Date: 02/01/07 17:56:18$\n" "@(#)---------:"; #if !defined(HILO_INCLUDED) # include "hilo.h" #endif char *PVCS_HILO_h=PVCS_HILO_H; /***************************************************************************** Your version *****************************************************************************/ Range myHilo(apvector &vector) { // This is cheating. Write your own myHilo. return Range(0,0); } /***************************************************************************** Test *****************************************************************************/ #if (TEST_HILO==TEST_HILO_ON) #include // INT_MAX, INT_MIN void test(int n,apvector &vector,Range &expectedRange) { if (vector.length()==0) { cout<<"Bad test vector!"< vector(1); vector[0]=0; Range range(0,0); test(1,vector,range); } { // Test 2 apvector vector(3); vector[0]=-10; vector[1]=0; vector[2]=10; Range range(-10,10); test(2,vector,range); } { // Test 3 apvector vector(2); vector[0]=INT_MAX; vector[1]=10; Range range(10,INT_MAX); test(3,vector,range); } { // Test 4 apvector vector(5); vector[0]=0; vector[1]=-12345; vector[2]=10; vector[3]=INT_MIN; vector[4]=0; Range range(INT_MIN,10); test(4,vector,range); } return(0); } #endif /****************************************************************************/