题解 | #取近似值#
取近似值
http://www.nowcoder.com/practice/3ab09737afb645cc82c35d56a5ce802a
//加0.5再进行强制类型转换即可
#include<iostream> using namespeace std; int main(){ double a; cin >> a; cout << int(a + 0.5) << endl; return 0; }
取近似值
http://www.nowcoder.com/practice/3ab09737afb645cc82c35d56a5ce802a
//加0.5再进行强制类型转换即可
#include<iostream> using namespeace std; int main(){ double a; cin >> a; cout << int(a + 0.5) << endl; return 0; }
相关推荐