complex<X>& complex<X>::operator+=(const complex<X>& kqrZ);
#include <complex>
complex<X>& complex<X>::operator+=(const X& kxrX); complex<X>& complex<X>::operator+=(const complex<Y>& kqrDiff);
#include <complex> #include <iostream> int main() { using namespace std; // Create a complex number complex<double> qZ(2.0, 4.0); cout << "Complex Number : "<< qZ << endl; // Create a second complex number and assign it complex<double> qZ2(.2, .3); qZ += qZ2; cout << "After the first assigment : "<< qZ << endl; // Make a second assignment to a "real" number qZ += 3.14; cout << "After the second assigment : "<< qZ << endl; // Make a third assignment with a different type complex<float> qFloatZ(2.0, 1.0); qZ += qFloatZ; cout << "After the third assigment : "<< qZ << endl; // Keep the window open cin.get(); return 0; }
© 20072024 XoaX.net LLC. All rights reserved.