complex<X> operator*(const complex<X>& kqrZ1, const complex<X>& kqrZ2);
#include <complex>
complex<X> operator*(const complex<X>& kqrZ, const X& kxrX); complex<X> operator*(const X& kxrX, const complex<X>& kqrZ);
#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 operator*
double dReal = 3.14;
cout << "Product 1 = " << (qZ1 * qZ2) << endl;
cout << "Product 2 = " << (qZ1 * dReal) << endl;
cout << "Product 3 = " << (dReal * qZ2) << endl;
// Keep the window open
cin.get();
return 0;
}
© 20072025 XoaX.net LLC. All rights reserved.