亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

可以具體點不?不是很明白啊~

可以具體點不?不是很明白啊~

C++
慕尼黑8549860 2022-12-18 12:08:34
int main(){complex< double> m=(5,1);cout <<m;return 0;} 我輸出的值為什么就只是 <1,0>對了, 還有就是 pair 類型的輸出,比如, 如何一起輸出這兩個值pair< string, string > author( "James", "Joyce" );
查看完整描述

2 回答

?
守候你守候我

TA貢獻1802條經驗 獲得超10個贊

因為你多寫了一個 “=”,去掉就對了。 
輸出pair只能重載<<操作符。

查看完整回答
反對 回復 2022-12-21
?
猛跑小豬

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;

查看完整回答
反對 回復 2022-12-21
  • 2 回答
  • 0 關注
  • 96 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號