// 121215 文件操作1.cpp : 定义控制台应用程序的入口点。
//
/*
* Copyright (c) 2012, 烟台大学计算机学院
* All rights reserved.
* 作 者: 刘同宾
* 完成日期:2012 年 12 月 15 日
* 版 本 号:v1.0
* 输入描述:
* 问题描述: 有一个整形数组,含10个元素,从键盘输入10个元素给数组,将此数组送到磁盘文件中存放
* 程序输出:
* 问题分析:略
* 算法设计:略
*/
#include "stdafx.h"
#include<fstream>
#include<iostream>
using namespace std;
int main()
{
int a[10];
ofstream outfile("f1.dat",ios::out);
if(!outfile)
{
cerr<<"open error!"<<endl;
exit(1);
}
cout<<"enter 10 integer numbers:"<<endl;
for(int i=0;i<10;i++)
{
cin>>a[i];
outfile<<a[i]<<" ";
}
outfile.close();
return 0;
}