/*
*copvriqht(c)2016,烟台大学计算机学院
*All rights reserved.
*文件名称:test.cpp
*作者:陈传祯
*完成日期:2016年6月18日
*版本号:v1.0
*
*问题描述
*输入描述
*程序输出
#include<cstdlib>
using namespace std;
int main()
{
short int x=12345;
ofstream outfile("binary.dat);
outfile<<x<<endl;
outfile.close();
return 0;
}
#include<iostream>
#include<fstream>
#include<cstdlib>
using namespace std;
int main()
{
short int x=12345;
ofstream outfile("binary.dat",ios::binary);
outfile.write((char*)&x,2);
outfile.close();
return 0;
}
*copvriqht(c)2016,烟台大学计算机学院
*All rights reserved.
*文件名称:test.cpp
*作者:陈传祯
*完成日期:2016年6月18日
*版本号:v1.0
*
*问题描述
*输入描述
*程序输出
*/
#include<iostream>
#include<fstream>#include<cstdlib>
using namespace std;
int main()
{
short int x=12345;
ofstream outfile("binary.dat);
outfile<<x<<endl;
outfile.close();
return 0;
}
#include<iostream>
#include<fstream>
#include<cstdlib>
using namespace std;
int main()
{
short int x=12345;
ofstream outfile("binary.dat",ios::binary);
outfile.write((char*)&x,2);
outfile.close();
return 0;
}