Counting the number of decimal places in pascal

后端 未结 3 1576
南方客
南方客 2021-01-15 19:40

I just started studying pascal and I have to do a pascal program as homework. I made it but I don\'t know how to count the number of decimal places in a real number<

3条回答
  •  说谎
    说谎 (楼主)
    2021-01-15 20:38

    if you're actually doing a writeln() output, surely just writeln(x); would accomplish what you're after? If you actually want to count the number of decimals, you'd probably have to convert to a string, remove any trailing zeroes, and see where the decimal point landed.

提交回复
热议问题