最近、私はコードのブロックを書きます:
const int sections = 10;
for(int t= 0; t < 5; t++){
int i = pow(sections, 5- t -1);
cout << i << endl;
}
そして結果は間違っています:
9999
1000
99
10
1
このコードだけを使用する場合:
for(int t = 0; t < 5; t++){
cout << pow(sections,5-t-1) << endl;
}
問題はもう発生しません。
10000
1000
100
10
1
誰か説明してくれませんか?どうもありがとうございます!