Re: [問題] 請問關於科學符號?
※ 引述《valda (valda)》之銘言:
: 大家好,請問個問題,若double超過一定的位數complier好像自動會轉成
: 科學符號,請問有辦法不讓他轉科學符號嗎?感謝
#include <iostream>
#include <iomanip>
using namespace std;
using std::setprecision;
int main(){
double d = 0.1;
int i=0;
for(int i=0;i<50;i++){
cout<<fixed<<setprecision(70)<<d<<endl;
d=d/10;
}
d=0.1;
for(int i=0;i<50;i++){
cout<<fixed<<setprecision(70)<<d<<endl;
d=d*10;
}
return 0;
}
關鍵字 iomanip cout<<fixed
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 211.74.187.51
→
09/05 00:39, , 1F
09/05 00:39, 1F
→
09/05 00:52, , 2F
09/05 00:52, 2F
→
09/05 00:55, , 3F
09/05 00:55, 3F
→
09/05 01:04, , 4F
09/05 01:04, 4F
討論串 (同標題文章)