首页 > 公务员
题目内容 (请给出正确答案)
[主观题]

有以下程序: #include <stdio, h>int a =2;int f(int n){ static int a: 3;intt=0;if(n%2){ stat

有以下程序: #include <stdio, h>int a =2;int f(int n){ static int a: 3; int t=0; if(n%2){ static int a=4;t+ =a++;} else { static int a=5;t+ :a++;} return t + a + +;main (){ int s=a,i; for(i=0;i<3;i++)s + =f(i); prinff("% d \n" ,s); }程序运行后的输出结果是()。

A.26

B.28

C.29

D.24

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“有以下程序: #include <stdio, h>int …”相关的问题
第1题
以下程序输出的结果是()。#include<iostream>using namespace std;int main(){int **x,*y,z=10;y=

以下程序输出的结果是()。 #include<iostream> using namespace std; int main() { int **x,*y,z=10; y=&z; x=&y; cout<< **x+1<<endl; return 0; }

A.11

B.x的地址

C.y的地址

D.运行错误

点击查看答案
第2题
有如下程序:#include<iostream>#include<cstring>using namespace std;class XCF{in

有如下程序:

#include<iostream>

#include<cstring>

using namespace std;

class XCF{

int a;

public:

XCF(int aa=O):a(aA){cout<<”1”;}

XCF(XCF&X){a=x.a;cout<<”2”;}

~XCF(){cout<<at}

int Geta(){return at}

};

int main(){

XCF dl(5),d2(d1);

XCF半pd=new XCF(8);

cout<<pd->Geta();

delete pd;

return 0;

}

运行时的输出结果是

A.1215588

B.1218855

C.12185

D.128512

点击查看答案
第3题
若有以下程序:#include using namespace std ; class Point { int x, y; public :Point () {
若有以下程序:#include using namespace std ; class Point { int x, y; public :Point () {

若有以下程序:

#include using namespace std ; class Point { int x, y; public :

Point () { x = 0; y = 0; } void SetPoint (int x1, int y1) { x = x1; y = y1; } void DisPoint () { cout << "x=" << x << "," << "y=" << y << endl ; } }; int main() { Point * p = new Point ; p-> SetPoint (5, 12); p-> DisPoint (); delete p; return 0; } 上面程序的输出结果为:

点击查看答案
第4题
有如下程序:#include<iostream>using namespace std;class Test{public:Test(){n+=2;}~Test(){n-

有如下程序: #include<iostream> using namespace std; class Test{ public: Test() {n+=2;} ~Test() {n-=3;} static int getNum(){return n;} private: static int n; }; int Test::n=1; int main() { Test*p=new Test; delete p; cout<<"n="<<Test::getNum()<<endl; return 0; } 执行后的输出结果是()

A.n=0

B.n=1

C.n=2

D.n=3

点击查看答案
第5题
阅读下面程序,写出输出结果。#include using namespace std ; class A { int a, b; public :
阅读下面程序,写出输出结果。#include using namespace std ; class A { int a, b; public :

阅读下面程序,写出输出结果。

#include using namespace std ; class A { int a, b; public : A() { a = b = 0; }

A(int aa, int bb) { a = aa; b = bb; cout << a << ' ' << b << endl ; } }; int main() { A x, y(2,3);

return 0; }

点击查看答案
第6题
有以下程序()

A.#include

B.0

C.-1

D.1

E.7

点击查看答案
第7题
有以下程序()

A.#include

B.x=4

C.x=8

D.x=6

E.x=12

点击查看答案
第8题
有以下程序: include<stclio.h> main() { char c; while((c=getchar())!=?)pu

有以下程序: include<stclio.h> main() { char c; while((c=getchar())!=?)putchar(--c); } 程序运行时,如果从键盘输入:Y?N?<回车>,则输出结果为【 】。

点击查看答案
第9题
有以下程序:#include<stdio.h>main(){int a [10]={1,2,3,4,5,6,7,8,9,10},*p=&a[3], *q=p+2;

有以下程序: #include <stdio.h> main() { int a [10]={1,2,3,4,5,6,7,8,9,10},*p=&a[3], *q=p+2; prinff("%d\n";*p+*q); } 程序运行后的输出结果是()。

A.16

B.10

C.8

D.6

点击查看答案
第10题
有以下程序:#include <stdio. h>main (){char a :'a',b; printf("% c," , + + a); printf("%c

有以下程序: #include <stdio. h> main () { char a :'a',b; printf("% c," , + + a); printf("%c \n" ,b =a++); }程序运行后的输出结果是()。

A.b,b

B.b,c

C.a,b

D.a,c

点击查看答案
第11题
有以下程序 include<stdio.h> include<string_h> voidfun(char*W,intm) {chars,*p1,*p2; p1

有以下程序 include<stdio.h> include<string_h> voidfun(char*W,intm) {chars,*p1,*p2; p1=w;p2=w+m-1; while(pl<p2){s=*p1;*p1=*p2;*p2=s;p1++;p2-;} } main() {1chara[]=“123456“; fun(a,strlen(a));puts(a); }

A.116611

B.161616

C.65432l

D.123456

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