首页 > 计算机类考试> 计算机等级考试
题目内容 (请给出正确答案)
[主观题]

有以下程序:#include<iostream>using namespace std;class MyClass{public: MyClass(); ~MyClass

有以下程序: #include<iostream> using namespace std; class MyClass { public: MyClass(); ~MyClass(); void SetValue(int val); private: static int i; }; int MyClass::i=0; MyClass::MyClass() { i++; cout<<i; } MyClass::~MyClass() { i--; cout<<i; } void MyClass::SetValue(int val) { i=val; } int main() { MyClass*my[2]; int k; for(k=0;k<2;k++) my[k]=new MyClass; for(k=0;k<2;k++) delete my[k]; return 0; } 运行后的输出结果是()。

A.1210

B.1100

C.1234

D.输出结果不确定

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“有以下程序:#include<iostream>using …”相关的问题
第1题
有以下程序: #include<string.h> #include<iostream.h> void main() { char * p="abcde\0fghjik\0"; cout < < strlen(p) ;} 程序运行后的输出结果是

A.12

B.15

C.6

D.5

点击查看答案
第2题
有以下程序:#include<stdio.h>#define X 5+6main(){int a=2,c;C=X*2:printf("%d",C);}程序运行后

有以下程序: #include<stdio.h> #define X 5+6 main() {int a=2,c; C=X*2: printf("%d",C); } 程序运行后的输出结果是()。

A.17

B.22

C.16

D.11

点击查看答案
第3题
有以下程序: #include<stdio.h> main() { int y=9; for(;y>0;y--) f(y%3==0)printf("%d",--y); } 程序的运行结果是()。

A.741

B.963

C.852

D.875421

点击查看答案
第4题
有以下程序#include<stdio.h>void main(){int a=1,b=0;printf("%d,",b=(a++)+(a++));pfintf("%d\

有以下程序 #include<stdio.h> void main() { int a=1,b=0; printf("%d,",b=(a++)+(a++)); pfintf("%d\n",a+B); } 程序运行后的输出结果是()。

A.4,6

B.2,5

C.3,5

D.2,6

点击查看答案
第5题
(21 )有以下程序# include (stdio.h >main (){ int a = l ; b = 2 ;for (; a < 8 ; a++ ) { b

(21 )有以下程序

# include (stdio.h >

main ()

{ int a = l ; b = 2 ;

for (; a < 8 ; a++ ) { b+=a ; a+=2 ; }

printf (" %d , %d \ n ", a , b ) ;

}

程序运行后的输出结果是

A ) 9 , 18

B ) 8 , 11

C ) 7 , 11

D ) 10 , 14

点击查看答案
第6题
有以下程序 #include<stdio.h> void WriteStr(char*fn,char*str) {FILE*fp; fp=f

有以下程序 #include<stdio.h> void WriteStr(char*fn,char*str) {FILE*fp; fp=fopen(fn"w");fputs(str,fp);fclose(fp); } main() { WriteStr("t1.dat"start"); WriteStr("t1,dat","end"); } 程序运行后,文件t1.dat中的内容是 ______。

A.start

B.end

C.startend

D.endrt

点击查看答案
第7题
‎有以下程序‎#include‎void main()‎{ int a,b,d=25;‏a=d/10%9;‏b=a&&(-1);‏printf("%d,%d/n",a,b);}‎程序运行后的输出结果是()。

A.2,1

B.2,0

C.3,1

D.6,1

点击查看答案
第8题
(29 )有以下程序# include (stdio.h )main (){ int a[5]= { 1 , 2 , 3 , 4 , 5 } , b[5] ={ O

(29 )有以下程序

# include (stdio.h )

main ()

{ int a[5]= { 1 , 2 , 3 , 4 , 5 } , b[5] ={ O , 2 , 1 , 3 , 0 } , i , s = 0 ;

for (i = 0 ; i < 5 ; i++ ) s = s+a[b[i] ] ) ;

printf (" %d \ n ", s ) ;

}

程序运行后的输出结果是

A ) 6

B ) 10

C ) 11

D ) 15

点击查看答案
第9题
有以下程序#includemain(){int y=9 ;for( ; y>0 ; y--)if(y%3==0 ) printf("%d" ,
有以下程序#includemain(){int y=9 ;for(; y>0 ; y--)if(y%3==0 ) printf("%d" ,

有以下程序

#include

main()

{

int y=9 ;

for(; y>0 ; y--)

if(y%3==0 ) printf("%d" , --y) ;}

程序的运行结果是_____

点击查看答案
第10题
有以下程序 #include<stdio.h> main() {int y=9; for(;y>0;y--) if(y%3==0)printf("%d",--y); } 程序的运行结粜是()。

A.741

B.963

C.852

D.875421

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改