c++ 怎麼用cout按指定位數四捨五入

1.引入頭文件 #include<iomanip>ios 2.輸出用固定格式  cout<<setiosflags(ios::fixed)<<setprecision(2)<<result<<endl; spa                                       //將result保留2位小數,四捨五入後輸出。ip
相關文章
相關標籤/搜索