[单选题]

下面程序的输出结果是

#include

class example

{

int a:

public:

example(int

B.{a=n++;}

void print(){a=a+1;cout < < a < <” ”;}

void print()const{cout<<<;}

}

void main()

{

example x t(3);

const example y(2);

x.print();

y.print();

}

A.2 2

B.4 3

C.4 2

D.3 2

参考答案与解析:

相关试题

下列程序的输出结果是 #include intmin(inta,intB) {

[单选题]下列程序的输出结果是#includeint min(int a,int B){if(aelse return B;return 0;}void main(){cout<<}A.0B.1C.2D.3

  • 查看答案
  • 下面程序的运行结果是 #include intfun(inta[].intn)

    [单选题]下面程序的运行结果是#includeint fun(int a[]. int n){int result=l:for(int i=1;iresult=result*a[i];return result;}void main(){int a[3]={3,4,5};cout<<}A.12;B.15;C.20;D.60

  • 查看答案
  • 下面程序的输出结果是 #include #include voidmain()

    [单选题]下面程序的输出结果是#include#includevoid main(){char p1[10],p2[10];strepy(p1,”abc”):strcpy(p2,”ABC”);char str[50]=”xyz”;strcpy(str+2,strcat(p1,p2));cout <}A.xyzabcABCB.zabcABCC.xyabcABCD.yzabcABC

  • 查看答案
  • 下面程序的输出结果是 ( ) # include # include { cha

    [单选题]下面程序的输出结果是 ( ) include include { char * p1="abc" , *下面程序的输出结果是 ( ) # include<stdio.h> # include<string.h> { char * p1="abc" , * p2=" ABC ",str[50]="xyz"; strcpy(str+2.strcat (pi,p2)); printf("%s/n",str);}A.xyzabcABB.zabcABCC.yzabcABCD.xyc

  • 查看答案
  • 下面程序的输出结果是 #include #includevoid main( )

    [单选题]下面程序的输出结果是 include includevoid main( ) { char p1[10] ,p2下面程序的输出结果是#include<iostream.h>#include<string.h>void main( ){char p1[10] ,p2[10] ;strcpy(p1,"abc") ;strcpy(p2,"ABC") ;char str[50] ="xyz";strcpy(str+2,strcat(p1,p2) ) ;cout < < str;}A.xyza

  • 查看答案
  • 下面程序输出的结果是( )。 #include using namespace

    [单选题]下面程序输出的结果是( )。 include using namespace std; void swap(int下面程序输出的结果是( )。 #include <iostream> using namespace std; void swap(int &a,int &b){ int temp; temp=a; a=b; b=temp; } void main(){ int x=2; int y=3; swap(x,y); cout<<x<<y; }A.23B.32C.abD.

  • 查看答案
  • 以下程序的输出结果是()Usingsystem;ClassExample1{Pu

    [单选题]以下程序的输出结果是()。Usingsystem;ClassExample1{PublicStaticvoidmain(){Inta=5,b=4,c=6,d;Console.Writeline(“{0}”,d=a>b?(a>c?a:c):b);}}A . 5B . 4C . 6D . 不确定

  • 查看答案
  • 下面程序输出的结果是 #include void main( ) { inti;

    [单选题]下面程序输出的结果是 include void main( ) { inti; int a[3] [3] ={1,2,3,4,5,6,下面程序输出的结果是#include<iostream.h>void main( ){ inti;int a[3] [3] ={1,2,3,4,5,6,7,8,91;for(i=0;i<3;i++)cout < < a[2-i] [i] < < " ";}A.1 5 9B.7 5 3C.3 5 7D.5 9 1

  • 查看答案
  • 下面程序的输出结果是 #include class example {int a

    [单选题]下面程序的输出结果是 include class example {int a; public: example(int b) {a=下面程序的输出结果是#include<iostream.h>class example{int a;public:example(int b) {a=b++;}void pnnt( ) {a=a+1;cout < < a < <" ";}void print( ) const{cout < < a < <" ";}};void main( ){exampl

  • 查看答案
  • 下面程序的输出结果是()。#include#includemain(){char

    [单选题]下面程序的输出结果是()。includeincludemain(){char p1[]="WHO",p2[]="who下面程序的输出结果是( )。 #include<stdio.h> #include<string.h> main() {char p1[]="WHO",p2[]="who",str[50]="xyz"; strcpy(str+1,strcat(p1,p2)); printf("%s",str);}A.xyzWHOwhoB.zWHOwhoC.zWHOwhoD.

  • 查看答案
  • 下面程序的输出结果是 #include classexample { inta: