华为机试-取近似值
#include<iostream>
using namespace std;int main()
{float fInput;while (cin>>fInput){int nTemp;nTemp = fInput * 10;int nHight = nTemp / 10;int nLow = nTemp % 10;if (nLow >= 5){nHight++;}cout << nHight;}return 0;
}
總結
- 上一篇: C++debug调试出现heap cor
- 下一篇: C++ 字符串(string类)