SOURCE FILE: pow_user.cpp



#include <iostream>
#include <cmath>
using namespace std ;

int main (void)
{
   double base, exponent, result ;

   cout << "\n\nThis program calculates powers -\n" ;
   cout << "'base' to the power 'exponent'\n\n" ;

   do 
   {
     cout << "Enter a positive base and an exponent.\n" ;
     cout << "Make the base negative when you want to stop: " ;
     cin >> base ;
     if (base > 0)
     {
       cin >> exponent ;
       result = pow(base, exponent) ;
       cout << base << " to the power " << exponent 
            << " is " << result << ".\n\n" ;
     } 
   } while (base > 0) ;

   cout << "\n\nThanks for using this program.\n\n" ;

   return 0;
}