题目描述:
You are given a real number , which is representable using at most three decimal digits, with three decimal digits.
Round to the nearest integer and print the result.XXXX
翻译:给你一个真实的数字,这是可代表使用最多三个小数位数,与三个小数位数。
转到最近的整数并打印结果。XXXX
- 0 leq X < 1000≤X<100
- XX最多使用三个小数数字表示。
- XX输入中有三个小数数字。
代码如下:
#includeusing namespace std; //原理就是四舍五入 int main() { double num ; int n = 0; //输入 cin >> num; //判断 if(0 <= num < 100){ n = num *= 1000; if(n/100 % 10 >= 5) { num/=1000; cout << (int)(num+1) << endl; } else { num/=1000; cout << (int)num <



