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

DABAN RP主题是一个优秀的主题,极致后台体验,无插件,集成会员系统
白度搜_经验知识百科全书 » C++循环小数的处理

0条评论

发表评论

提供最优质的资源集合

立即查看 了解详情