// INSERT2.CPP - Second example from Section 8.3.1. // Here we handle the exception only in main(). #include #include "range.h" const unsigned ArraySize = 50; int array[ArraySize]; void InsertValue( unsigned i, int value ) { if( i >= ArraySize ) throw RangeError(__FILE__, __LINE__, i); // __FILE__ is a macro that returns the current // file name.__LINE__ is a macro that returns de line number array[i] = value; } void TestTheArray() { unsigned j; int anInt; cout << "Enter a subscript and a value: "; cin >> j >> anInt; InsertValue( j, anInt ); } int main() { //... try { TestTheArray(); } catch( RangeError & R) { cout << "Range error in main() Line:" << __LINE__ <