第十六周项目一 d阅读程序(3)
来源:互联网 发布:美元霸主地位知乎 编辑:程序博客网 时间:2024/05/22 07:48
/*copyright(c)2016.烟台大学计算机学院 * All rights reserved, * 文件名称:text.Cpp * 作者:舒文超 * 完成日期:2016年6月10日 * 版本号:vc++6.0 * 问题描述:阅读下面的程序,指出其功能,体会seekg()、 tellg()等函数的功能及其用法 */#include <iostream>#include <fstream>using namespace std;int main(){ fstream outfile,infile; outfile.open("data.txt",ios::out); for (int i=0; i<26; i++) outfile<<(char)('A'+i); outfile.close(); infile.open("data.txt",ios::in); char ch; infile.seekg(6,ios::beg); if(infile.get(ch)) cout<<ch; infile.seekg(8,ios::beg); if(infile.get(ch)) cout<<ch; infile.seekg(-8,ios::end); if(infile.get(ch)) cout<<ch; cout<<endl; infile.close(); return 0;}
文件显示:
0 0
- 第十六周项目一 d阅读程序(3)
- 第十六周项目一 d阅读程序(1)
- 第十六周项目一 d阅读程序(2)
- 第十六周项目一----阅读程序
- 第十六周项目一 c阅读程序
- 第十六周项目一 a阅读程序(3)
- 第十六周项目 阅读程序(3)
- 第十六周 阅读程序一(3)
- 第十六周项目一 a阅读程序(1)
- 第十六周项目一 a阅读程序(2)
- 第十六周项目一 b阅读程序(1)
- 第十六周项目一 b阅读程序(2)
- 第十六周项目3—阅读程序(3)
- 第十六周项目3—阅读程序(3)
- 第十六周上机实践项目3(3):阅读程序
- 第十六周项目1—阅读程序(3)
- 第十六周项目2—阅读程序(3)
- 第十六周项目3—阅读程序(1)
- Android AsyncTask 应用
- AndroidStudio常用快捷键
- php笔记(11)——json_encode后中文编码问题
- ArcGIS连接局域网另一台电脑上的SQLServer数据库
- [转]Linux GCC常用命令
- 第十六周项目一 d阅读程序(3)
- 5710 Digit-Sum(找规律)
- 真机中ssh连接virtualBox中的虚机
- Scala语言初入门
- Android Handler 机制
- Android onSaveInstanceState与onRestoreInstanceState
- Linux下搭建本地yum源,rpm 安装,源码安装
- leetcode笔记--Minimum Depth of Binary Tree
- Android 面试精华题目总结