vc++中,请问怎么让他显示小数形式? 程序如下,我运行出来变成科学记数法的样子了。回答出来追加悬赏

//geshi.cpp
//将综合的数据文件转化为输入的文件格式
#include<iostream.h>
#include<iomanip.h>
#include "fstream.h"
#include "stdlib.h"
void main()
{
int year1,year2,month,day,hour,stab;
double wd,ws,temp,nomh,chmh;
ifstream infile;
ofstream outfile;
infile.open("geshiqian.txt",ios::in);
outfile.open("geshihou.txt",ios::in);
if(!infile)
{
cout<<"cannot open file"<<endl;
exit(1);
}
while(1)
{
infile>>year1>>year2>>month>>day>>hour;
infile>>wd>>ws>>temp>>stab>>nomh>>chmh;
setiosflags(ios::right);
outfile<<setw(1)<<year1<<setw(1)<<year2<<setw(2)<<month<<setw(2)<<day<<setw(2)<<hour;
setiosflags(ios::fixed);
outfile<<setw(9)<<setprecision(1)<<wd;
outfile<<setw(9)<<setprecision(1)<<ws;
outfile<<setw(6)<<setprecision(1)<<temp;
outfile<<setw(2)<<stab;
outfile<<setw(7)<<setprecision(3)<<nomh;
outfile<<setw(7)<<setprecision(3)<<chmh<<'\n';
if(infile.eof())break;
}
infile.close;
outfile.close;
}

int year1,year2,month,day,hour,stab;把int换成float试试,不知道对不对,
温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-01-08
cout<<setiosflags(ios_base::fixed)<<....你试试吧本回答被提问者采纳