#include <iostream> #include <complex> using namespace std; int main() { complex<double> x1(1.0, 2.0), x2(3.0), x3 = 2.0, x4 = 2i, x5; cout << "x1:" << x1 << ",x2:" << x2 << ",x3:" << x3 << ",x4:" << x4 << ",x5:" << x5 << endl; cout << "x1 + x2 = " << (x1 + x2) << endl; cout << "x1 - x2 = " << (x1 - x2) << endl; cout << "x1 * x2 = " << (x1 * x2) << endl; cout << "x1 / x2 = " << (x1 / x2) << endl; cout << "abs(x1) = " << abs(x1) << endl; cout << "x1 の共役複素数 = " << conj(x1) << endl; return 0; }