int main(){complex< double> m=(5,1);cout <<m;return 0;} 我输出的值为什么就只是 <1,0>对了, 还有就是 pair 类型的输出,比如, 如何一起输出这两个值pair< string, string > author( "James", "Joyce" );
2 回答
猛跑小猪
TA贡献1858条经验 获得超8个赞
complex<double>
The explicitly specialized template class describes an object that stores an ordered pair of objects both of type double, first representing the real part of a complex number and the second representing the imaginary part.
第一个改下:
complex< double> m(5,1.02);
cout <<m.imag()<<endl;
cout <<m.real();
pair< string, string > author( "James", "Joyce" );
cout<<author.first<<endl;
cout<<author.second<<endl;
- 2 回答
- 0 关注
- 73 浏览
添加回答
举报
0/150
提交
取消