// ;----------------------------------------------------------- // ; Program Name: Class_Demo // ; File: Demoprob4.cpp // ; Description: Performs a bubble sort of a large integer array // ; // ; Author: Jim Adams // ; Assignment: None // ; Environment: MS C++ 6.0 // ; Revisions: 10/02/2000 Original version // ;----------------------------------------------------------- #include // has cout stuff #include // Has srand function #include // has time funstions const int MAX=10000; int arr[MAX]; long iterations=0; bool we_swapped_one; void seed_the_array(void); void sort_the_array(void); void dump_the_array(void); void swap(int&, int&); void main( void ) { seed_the_array(); sort_the_array(); dump_the_array(); } // Seed the random-number generator with current time so that // the numbers will be different every time we run. void seed_the_array() { int i; srand( (unsigned)time( NULL ) ); for(i = 0; i arr[i+1]) swap(arr[i], arr[i+1]); } } while (we_swapped_one); } // Print out the contents of the array void dump_the_array() { int i; for( i = 0; i