#include<iostream>
#include<fstream>
using namespace std;
int main()
{
double x,y,z;
int m;
ofstream outfile("d:/a/f1.txt",ios::in);
if(!outfile)
{
cerr<<"open f1.txt error!\n";
return 0;
}
cout<<"The first number is ";
cin>> x;
outfile<<x<<endl;
cout<<"The second number is ";
cin>>y;
outfile<<y<<endl;;
cout<<"The third number is ";
cin>> z;
outfile<<z<<endl;
m=(x+y+z)/3+0.5;
outfile<<m<<endl;
cout<<"The average number is "<<m<<endl;
outfile.close();
return 0;
}
追问复制挺快的嘛;
by the way ,thanks
本回答被提问者采纳