填空题
下面程序的运行结果是( )。
#include
#include
using namespace std;
class Sample
{
public:
Sample(int i=0,int j=0)
{
m_x=i;
m_y=j;
}
void Print 1
{
cout<<"m_x="<2
{
Sample sl(1,2),s2(3,4),s3;
fstream file;
file.open("file.dat",ios::inlios::outlios::trunc):
if(!fileds_open 3)
{
cerr<<"file.dat can't open"<4;
file.read((char*)&s3,sizeof(s3));
s3.Print 5;
file.close 6;
return 0;
}
【正确答案】
1、m_x=1,m_y=2 m_x=3,m_y=4
【答案解析】