/*Copyright (c) 2016,烟台大学计算机学院
*All rights reserved.
*文件名称 :
*作 者 : 李钊
*完成日期 : 2016年6月14号
*版 本 号 : v1.0
*
*问题描述 : 阅读程序
*输入描述 :
*程序输出 :
*/
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
int main( )
{
int a;
ofstream outfile("f1.dat",ios::out);
if(!outfile)
{
cerr<<"open error!"<<endl;
exit(1);
}
cin>>a;
outfile<<a<<endl;
outfile.close();
return 0;
}
分析:
在屏幕上输入数字到a,然后保存到f1.dat文件中