首页 > 其他 > 详细

使用complex对象

时间:2016-03-21 23:07:26      阅读:502      评论:0      收藏:0      [点我收藏+]

#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

使用complex对象

原文:http://www.cnblogs.com/changbo/p/5304151.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!