</pre><pre class="cpp" name="code">/*
* Copyright (c) 2014, 烟台大学计算机学院
* All rights reserved.
* 文件名称:test.cpp
* 作 者:呼亚萍
* 完成日期:2015年6月15日
* 版 本 号:v1.0
*
* 问题描述: 阅读并运行下面的两个程序,分别用记事本和二进制文件阅读器(请自行下载Binary Viewer等程序,或者用DOS中的Debug程序,并百度其用法)。查看其内容,并理解文件存储的原理。
* 程序输入:相应的程序
* 程序输出:对应得结果
*/
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
int main( )
{
int a;
ofstream outfile("f1.dat",ios::out);
if(!outfile)
{
cerr<<"open error!"<<endl;
exit(1);
}
cin>>a;
outfile<<a<<endl;
outfile.close();
return 0;
}
运算结果:
知识点总结:
Binary Viewer能够显示数据以十进制,八进制,十六进制和文本(ASCII码或统一的字符编码标准)的格式。
学习心得:
软件的使用使自己进一步认识到计算机的变幻莫测,希望学习更多的计算机知识,一步步走进计算机的世界!