磁盘文件输入的小问题,开口有分
下面这程序是用来检测数据是否输入成功的小程序,是在VC6.0下完成的,编译执行都通过 但是从键盘输入后,U盘里面的zuoye.dat里面还是什么都没有,请问是哪儿出了问题,高手们请讲来,谢谢~~~
#include<fstream>
#include<iostream>
using namespace std;
int main()
{
int a[10];
ofstream outfile("zuoye.dat",ios::out);
if(!outfile)
{
cerr<<"open error!"<<endl;
exit(1);
}
cout<<"input 10 int numbers:"<<endl;
for(int i=0;i<10;i++)
{
cin>>a[i];
outfile<<a[i]<<" ";
}
outfile.close();
return 0;
}