complex<X> pow(const complex<X>& kqrBase, const complex<X>& kqrExponent);
#include <complex>
complex<X> pow(const complex<X>& kqrBase, int iExponent); complex<X> pow(const X& kxrBase, const complex<X>& kqrExponent); complex<X> pow(const complex<X>& kqrBase, const X& kxrExponent);
#include <complex> #include <iostream> int main() { using namespace std; // Create two complex numbers complex<double> qZ1(2.0, 4.0); complex<double> qZ2(1.3, 5.1); cout << "Complex Number 1 : "<< qZ1 << endl; cout << "Complex Number 2 : "<< qZ2 << endl; // Try each version of the pow() function double dReal = 3.14; int iInt = 2; cout << "Complex base and exponent: " << pow(qZ1, qZ2) << endl; cout << "Complex base and int exponent: " << pow(qZ1, iInt) << endl; cout << "Real base and complex exponent: " << pow(dReal, qZ1) << endl; cout << "Complex base and real exponent: " << pow(qZ1, dReal) << endl; // Keep the window open cin.get(); return 0; }
© 20072024 XoaX.net LLC. All rights reserved.