#include<iostream> using namespace std; int main(void) { float a = 12.234; int b = 12; cout.precision(1); cout << fixed << a *1.0 << " " << b*1.0 <<endl; }
使输出的数据始终精确到小数点后一位
#include<iostream> using namespace std; int main(void) { float a = 12.234; int b = 12; cout.precision(1); cout << fixed << a *1.0 << " " << b*1.0 <<endl; }
使输出的数据始终精确到小数点后一位