Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

c語言 pow函數

不使用fixed 和setprecision()等..為前提

正常狀況下 cout << pow(5.2,8);

為何 唯獨只有7和8次方沒小數點後1位?

Update:

也不使用cout.precision()

如何會有小數點?也不使用任何的精確度等函數

1 Answer

Rating
  • 鳳琳
    Lv 5
    1 decade ago
    Favorite Answer

    因為 precision() 預設是 6

    試看看這個會印出多少就知道了

    std::cout << std::cout.precision() << std::endl;

    2007-04-16 21:10:00 補充:

    那你大概要自己重寫一個把浮點數字轉換成你想顯示的樣子的功能.

Still have questions? Get your answers by asking now.