第十六周项目1—阅读程序(1)
来源:互联网 发布:老外吃中国菜知乎 编辑:程序博客网 时间:2024/04/27 18:45
/**Copyright(c) 2016.烟台大学计算机与控制工程学院*ALL rights reserved.*文件名称:test.cpp*作者:杨驰*完成日期:2016年6月14*问题描述:程序阅读 文件操作*/#include <iostream>#include <fstream>using namespace std;int main(){ fstream outfile,infile; outfile.open("data.dat",ios::out); outfile<<"1111111111"<<endl; outfile<<"aaaaaaaaaa"<<endl; outfile<<"AAAAAAAAAA"<<endl; outfile<<"**********"<<endl; outfile.close(); infile.open("data.dat",ios::in); char line[80]; int i=0; while(!infile.eof()) { i++; infile.getline(line,sizeof(line)); cout<<i<<": "<<line<<endl; } infile.close(); return 0;}
运行结果:
0 0
- 第十六周项目 阅读程序(1)
- 第十六周项目1:阅读程序
- 第十六周项目1—阅读程序(1)
- 第十六周项目1—阅读程序(1)
- 第十六周项目1—阅读程序(1)
- 第十六周项目1—阅读程序(2)
- 第十六周项目1—阅读程序(3)
- 第十六周项目2—阅读程序(1)
- 第十六周项目3—阅读程序(1)
- 第十六周项目1—阅读程序(2)
- 第十六周项目1—阅读程序(3)
- 第十六周项目2—阅读程序(1)
- 第十六周项目3—阅读程序(1)
- 第十六周项目1—阅读程序(2)
- 第十六周阅读程序-1
- 第十六周阅读程序1
- 第十六周 阅读程序1
- 第十六周上机实践项目1(1):阅读程序
- 剑指offer-003
- 第十六周阅读程序4
- C++之多线程(POSIX多线程实例)
- _dllmain@12 重定义 可能原因
- python 字符串 大小写转换
- 第十六周项目1—阅读程序(1)
- 机器学习10大经典算法
- 图解ByteBuffer
- LAMP环境搭建
- 访问者模式
- View 的工作原理
- Android studio 执行debug模式时一直报Socket closed
- libuv学习笔记(10)
- 感冒的一般过程