file1.cpp
extern double pow(double x, int n)
{
double result = 1.0;
bool negative = false;
if (n < 0)
negative = true;
while(n)
{
if(n & 1)
{
result *= x;
}
x *= x;
n = n / 2;
}
return negative ? (1.0 / result) : result;
}
file2.cpp
#include
using namespace std;
extern double pow(double x, int n);
void main()
{
double a = 0;
int b = 1, m = 0;
cin >> a >> m;
cout << "a * b = " << a * b << endl;
cout << "a ^ m = " << pow(a, m) <}