输入双精度浮点数,输出整型,写c++代码
#include <iostream>
using namespace std;
int main()
{
double d;
cout << "Enter a double value: ";
cin >> d;
// typecasting double to int
int i = (int)d;
cout << "Integer value: " << i << endl;
return 0;
}
免责声明:
以上内容除特别注明外均来源于网友提问,创作工场回答,未经许可,严谨转载。