/*
* 程序的版权和版本声明部分
* Copyright (c)2012, 烟台大学计算机学院学生
* All rightsreserved.
* 文件名称: fun.cpp
* 作 者: 赵冠哲
* 完成日期:2012年11月16日
* 版本号: v1.0
* 对任务及求解方法的描述部分
* 输入描述:输入十个数
* 问题描述:学会单步执行和调试程序
* 程序输出:在文件中输出十个数
*/
#include<fstream>
#include<iostream>
using namespace std;
int main()
{
int a;
ofstream outfile("f5.dat",ios::out);
if(!outfile)
{
cerr<<"open error!"<<endl;
exit(1);
}
for(int i=0;i<10;i++)
{
cin>>a;
outfile<<a<<endl;
}
outfile.close();
cout<<"处理完毕,请打开文件查看结果!"<<endl;
return 0;
}
运行结果:
心得体会:学会单步执行和调试程序非常重要啊。。。。应该加以深刻的学习。