    Power Demonstration 

    This program displays the result of raising a ualue (base) to a power 
(exponent). To force an exception, enter a negative base and a fractional 
exponent (e.g. -4 and 1.5) Or, enter a zero base and an exponent less than zero. 

    base? -4 
    exponent? 1.5 
    Domain error: base:-4 exponent: 1.5 
    Error detected: Try again! 
    base? 9 
    exponent? -9.93 
    Domain error: base: exponent:-9.99 
    Error detected: Try againI 
    base? 2 
    exponent? 16 
    result ** 65536 
    Program is ending normally. 

    . 15.1.    2 


     15.17. 2. (     ) 

    1:	//  	     
    2: 
    3:	#include <iostream.h> 
    4:	#include <math.h> 
    5: 
    6:	//     ,  
    7:	//  ,       Power() 
    8:	Class Error; 
    9: 
    10:	//   (     Power)   
    11:	void Instruct();	
    12:	void Run(); 
    13:	double Pow(double b, double e); 
    14:	double Power(double b, double e) throw(Error); 
    15:		
    16:	//       
    17: 	class Error {
    18:	   double b;  // Base
    19:	   double e;  // Exponent	
    20:	public: 
    21:	   Error() 
    22:	        { cout  "Error in source code!"  endl; } 
    23:	   Error( double bb, double	) 
    24:	            : b(bb). e(ee) { } 
    25:	   void Report(); 
    26:	}; 
    27: 
    28:	int main () 
    29:	{ 
    30:	  Instruct(); 
    31:	  for (;;) { 
    32:	     try { 
    33:	        Run(); 
    34:	        cout  "Program is	ending normally. "  endl; 
    35:	        return 0; //       
    36:	    } 
    37:	    catch (...) { 
    38:	       cout  "Error detected: Try again!"  endl; 
    39:	    } 
    40:	  } 
    41:	} 
    42: 
    43:	void Instruct()
    44:	{ 


    408      III.   ANSI C++
