[問題] C++作業一問
想請問 題目要我做什麼 我努力的查字典 可是還是擔心我翻譯的是錯誤的
>>
Function floor can be used to round a number to a specific decimal place. The statement
y = floor( x * 10 + .5 ) / 10;
rounds x to the tenths position
(the first position to the right of the decimal point). The statement
y = floor( x * 100 + .5 ) / 100;
rounds x to the hundredths position
(the second position to the right of the decimal point).
Write a program that defines four functions to round a number x
in various ways:
roundToInteger( number )
roundToTenths( number )
roundToHundredths( number )
roundToThousandths( number )
For each value read, your program should print the original value,
the number rounded to the nearest integer,
the number rounded to the nearest tenth,
the number rounded to the nearest hundredth
and the number rounded to the nearest thousandth.
首先 floor 指令 的意思 我大概知道 就是回傳一個最大的整數 但不大於本身
題目的意思 是要我 建立四個function
分別是做什麼呢? 希望大大幫我 感謝 只要告訴我究竟在問什麼><"
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.169.141.205
→
06/12 20:20, , 1F
06/12 20:20, 1F
討論串 (同標題文章)