下面程序的输出结果是 ______。includevoidmain(){intx=20;int&y=x;cout下面程序的输出结果是 ______。 #include<iostream.h> void main(){ int x=20; int &y=x; cout<<(x==y)<<“”; cout<<(&x==&y)<<end1: }A.20 20 20 20B.20 20C.1 1D.出错

题目
下面程序的输出结果是 ______。includevoidmain(){intx=20;int&y=x;cout<<(x==y

下面程序的输出结果是 ______。 #include<iostream.h> void main(){ int x=20; int &y=x; cout<<(x==y)<<“”; cout<<(&x==&y)<<end1: }

A.20 20 20 20

B.20 20

C.1 1

D.出错


相似考题
更多“下面程序的输出结果是 ______。#include<iostream.h>voidmain(){intx=20;int&amp;y=x;cout<<(x==y ”相关问题
  • 第1题:

    以下程序的执行结果是______。 include void main() { int x=5 y=2; cout<

    以下程序的执行结果是______。

    include<iostream.h>

    void main()

    {

    int x=5 y=2;

    cout<<! (y==x/2)<<",";

    cout<<(y!=x%3)<<",";

    cout<<(x>0 && y<0=<<",";

    cout<<(x!=y||x>=y)<<endl;

    }


    正确答案:0001
    0,0,0,1

  • 第2题:

    下面程序的输出结果是【】。includeint add(int a, int b);void main(){extern int x,

    下面程序的输出结果是【 】。

    include<iostream.h>

    int add(int a, int b);

    void main()

    {

    extern int x, y;

    cout<<add(x, y)<<end1;

    }

    int x(20),y(5);

    int add(int a, int b)

    {

    int s=a+ b;

    return s;

    }


    正确答案:25
    25

  • 第3题:

    下面程序的输出结果是()。includevoid main(){int x=-1,y=5,z;z=(x++<0)&&

    下面程序的输出结果是( )。#include<iostream.h>void main(){int x=-1,y=5,z;z=(x++<0)&& (y-->=0);cout<<x<<'\t'<<y<<'\t'<<z<<end1;}

    A.-1 5 0

    B.-1 4 1

    C.0 4 1

    D.0 4 0


    正确答案:C

  • 第4题:

    下列程序段的输出结果是includevoid fun(int * x,int * y){cout<<* X<<* y; *X=3;

    下列程序段的输出结果是 #include<iostream.h> void fun(int * x,int * y) { cout << * X << * y; *X=3; *y=4; } void main() { int x=1,y=2; fun(&y,&x); cout << X << y<<endl; {

    A.2143

    B.1212

    C.1234

    D.2112


    正确答案:A
    解析:在fun函数中,x接收的是main函数中y的地址,所以*x值为2,同样,*y值为1,所以第1次输出的是21,第2次改变*x的值等同于改变y的值,改变*y的值也即改变x的值,所以第2次输出的是43。注意:C++语言中函数的传参方式中关于指针的应用。

  • 第5题:

    下列程序段的输出结果是includevoid fun(int*x,int*y){cout<<*x<<*y;*X=3;*y=4;}vo

    下列程序段的输出结果是 #include<iostream.h> void fun(int*x,int*y) {cout<<*x<<*y; *X=3; *y=4; } void main() {int x=1,y=2; fun(&y,&x); cout<<X<<y<<endl; }

    A.2143

    B.1212

    C.1234

    D.2112


    正确答案:A