取近似值c++
取近似值
http://www.nowcoder.com/questionTerminal/3ab09737afb645cc82c35d56a5ce802a
#include<iostream> using namespace std; int main() { double num; cin>>num; if(num-(int)num>=0.5) cout<<int(num)+1; else cout<<int(num); return 0; }
取近似值
http://www.nowcoder.com/questionTerminal/3ab09737afb645cc82c35d56a5ce802a
#include<iostream> using namespace std; int main() { double num; cin>>num; if(num-(int)num>=0.5) cout<<int(num)+1; else cout<<int(num); return 0; }
相关推荐