64,676
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main (int argc, char *argv[])
{
std::ofstream ostrm("D:\\1.txt",std::ios::out);
double a=1234.56789;
double b=987.6543;
ostrm.precision (10); //设置精度
ostrm <<a <<'\n';
ostrm <<b;
ostrm.close();
return 0;
}
/** D:\\1.txt
1234.56789
987.6543
*/