[主观题]

执行以下程序,输出结果的最后一行语句是______。 include class Sample { int x,y;

执行以下程序,输出结果的最后一行语句是______。

include <iostream.h>

class Sample

{

int x,y;

public:

Sample(){x=y=0;}

Sample(int a,int b){x=a;y=b;}

~Sample()

{

if(x==y)

cout<<"x!=y"<<end1;

else

cout<<"x!=y"<<end1;

}

void disp()

{

cout<<"x="<<x<<",y="<<y<<end1;

}

};

void main()

{

Sample s1(2,3);

s1.disp();

}

参考答案与解析:

相关试题

下列程序的执行结果是______。 #include #include clas

[单选题]下列程序的执行结果是______。 include include class TestClass { publ下列程序的执行结果是______。 #include<iostream.h> #include<stdlib.h> class TestClass { public: int x,y; TestClass () {x=y=0;} TestClass (int a,int b){x=a;y=b;} void disp() { cout<<"x="<<x<<",y="<<y<<en

  • 查看答案
  • 下面程序运行时输出结果为______。 include include clas

    [单选题]下面程序运行时输出结果为______。 include include class Rect { public: Rect(int下面程序运行时输出结果为______。include<iostream.h>includeclass Rect{public:Rect(int l, int w){length=l; width=w;)void Print(){cout<<"Area:"<<length*width<<end1;}void operator delete(void*p){free(

  • 查看答案
  • 以下程序执行后输出的结果是()。 include include using n

    [主观题]以下程序执行后输出的结果是()。 include include using namespace std; int以下程序执行后输出的结果是[ ]。include<iostream>include<fstream>using namespace std;int main(){ofstream ofile("D://temp.txt");if(!ofile){cout<<"temp.txt cannot open"<<endl;return 0;}ofile<<"This is a bo

  • 查看答案
  • 执行以下程序的输出结果是 _[18]_______ .#include <sti

    [试题]执行以下程序的输出结果是 _[18]_______ .#include <stido.h>main(){ int i,n[4]={1};for(i=1;i<=3;i++){ n[i]=n[i-1]*2+1; printf("%d",n[i]); }}

  • 查看答案
  • 以下程序执行后的输出结果是 ( )。#include class Basel{p

    [单选题]以下程序执行后的输出结果是 ( )。include class Basel{public: void fun(){ cout<<以下程序执行后的输出结果是 ( )。 #include <iostream.h> class Basel { public: void fun(){ cout<<"Basel"<<end1; } }; class Base2 { public: void fun() { cout<<"Base2"<<end1; } } class Derived : publi

  • 查看答案
  • 以下程序执行后的输出结果是#include using namespace st

    [单选题]以下程序执行后的输出结果是include using namespace std;void try(int,int,int,int)以下程序执行后的输出结果是 #include <iostream> using namespace std; void try(int,int,int,int); int main () { int x,y,z,r; x =1 ; y = 2; try(x,y,z,r); cout<<r<<endl; return 0; } void try(int x,int y

  • 查看答案
  • 有以下程序 , 程序执行后 , 输出结果是( 1 1 )#include <st

    [试题]有以下程序 , 程序执行后 , 输出结果是( 1 1 )#include <stdio.h>void fun(int *a){ a[0]=a[1];}main(){ int a[10]={10,9,8,7,6,5,4,3,2,1},i;for(i=2;i>=0;i--) fun(&a[i]);for(i=0;i<10;i++) printf("%d",a[i]);printf("/n");}

  • 查看答案
  • 执行如下程序后的输出结果是()。include include using na

    [单选题]执行如下程序后的输出结果是()。include include using namespace std;int ma执行如下程序后的输出结果是[ ]。include <iostream>include <fstream>using namespace std;int main ( ){char s[25];ofstream fl("data.txt");f1<<"C++ Programming";f1.close ();ifstream f2 ("data.txt");

  • 查看答案
  • 执行以下程序的输出结果是_[18]_______ #include<stido.

    [主观题]执行以下程序的输出结果是_[18]_______#include <stido.h>main(){ int i,n[4]={1};for(i=1;i<=3;i++){ n[i]=n[i-1]*2+1; printf("%d",n[i]); }}

  • 查看答案
  • 下列程序执行的输出结果是()。 #inClude main() {char a[

    [单选题]下列程序执行的输出结果是()。 inClude main() {char a[2][4]; strcpy(a,"are");strcpy下列程序执行的输出结果是( )。#inClude<stdio.h>main(){ char a[2][4];strcpy(a,"are");strcpy(a[1],"you");a[0][3]='&';printf("%s/n",A) ;}A.are&youB.youC.areD.&

  • 查看答案
  • 执行以下程序,输出结果的最后一行语句是______。 include  clas