-->
当前位置:首页 > 题库

PROGRAMMING:Rounding problem (short version)

Luz5年前 (2021-05-10)题库411
Please write a function to round the decimal.
```c
double Round(double x, int d);
```
Note: ` X 'is any real number and ` d' is the small digit. The function value is' x ', only the approximate value of'd' decimal place is reserved, and the last decimal place is rounded.
####Input sample
>Real $$x $$and integer $$d$$
####Output sample
>Approximate value of real number $$x $(requirement: output with format qualifier% F.)
####Input sample 1
```in
1725.836 2
```
####Output sample 1
```out
one thousand seven hundred and twenty-five point eight four zero zero zero zero
```
####Input sample 2
```in
-18.253349 4
```
####Output sample 2
```out
-18.253300
```
####Input sample 3
```in
812.75 0
```
####Output sample 3
```out
eight hundred and thirteen
```
####Input sample 4
```in
45319.75 -2
```
####Output sample 4
```out
forty-five thousand and three hundred
```







answer:If there is no answer, please comment