// FILE: itemdemo.cpp // Demonstration program for the Item template toolkit #include #include #include "itemtool.h" int main( ) { const size_t SIZE = 5; double r; size_t i; double data[SIZE]; // Insert 5 numbers in the array for (i = 0; i < SIZE; i++) { r = 10-i; ordered_insert(data, i, r); } // Print the array; swap two items; print again for (i = 0; i < SIZE; i++) cout << data[i] << endl; for (i = 0; i < SIZE; i++) cout << data[i] << endl; // Test the other two functions cout << "Biggest of first two is: " << maximal(data[0], data[1]) << endl; cout << "Index of biggest is: " << index_of_maximal(data, SIZE) << endl; return EXIT_SUCCESS; }