C++循環小數的処理,第1張

C++循環小數的処理,第2張

問題描述:
  Write a program that will accept a fraction of the form N/D, where N is the numerator and D is the denominator and print the decimal representation. If the decimal representation has a repeating sequence of digits, indicate the sequence by enclosing it in brackets. For example, 1/3 = .33333333...is denoted as 0.(3), and 41/333 = 0.123123123...is denoted as 0.(123). Use xxx.0 to denote an integer. Typical conversions are:
  1/3 = 0.(3) //將循環部分用( )擴起來。
  22/5 = 4.4
  1/7 = 0.(142857)
  2/2 = 1.0
  3/8 = 0.375
  45/56 = 0.803(571428)
  Input :
  A single line with two space separated integers,N and D,1


生活常識_百科知識_各類知識大全»C++循環小數的処理

0條評論

    發表評論

    提供最優質的資源集郃

    立即查看了解詳情