码迷,mamicode.com
首页 > 编程语言 > 详细

数组送到磁盘文件存放

时间:2018-08-02 11:26:45      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:name   put   open   err   out   文件   enter   col   pen   

 1 #include <iostream>
 2 #include <fstream>
 3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
 4 using namespace std;
 5 int main(int argc, char** argv) {
 6     int a[10];
 7     ofstream outfile("f1.dat",ios::out);
 8     if(!outfile)
 9     {
10         cerr<<"open error!"<<endl;
11         exit(1);
12     }
13     cout<<"enter 10 integer numbers:"<<endl;
14     for(int i=0;i<10;i++)
15     {
16         cin>>a[i];
17         outfile<<a[i]<<" ";
18     }
19     outfile.close();
20     return 0;
21 }

 

数组送到磁盘文件存放

标签:name   put   open   err   out   文件   enter   col   pen   

原文地址:https://www.cnblogs.com/borter/p/9405566.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!