#include<iostream>
#include<string>
#include<complex>
using namespace std;
void main()
{
complex <int> num1(3, 4);
complex <float> num2(3.3, 4.5);
string str1("real is ");
string str2 = "imag is ";
cout << str1 << num1.real() << "," <<str2<< num1.imag() << endl;
cout << str1 << num2.real() << "," <<str2<< num2.imag() << endl;
}
运行结果:
end
时间: 2024-11-14 02:07:50