搜题
网友您好,请在下方输入框内输入要搜索的题目:
搜题
题目内容 (请给出正确答案)
提问人:网友liuqlgxk 发布时间:2022-01-06
[主观题]

有以下程序#include<stdio.h>#include<stdlib.h>main(){int*a,*b,*c;a=b=c=(int*)m

有以下程序

#include<stdio.h>

#include<stdlib.h>

main()

{int*a,*b,*c;

a=b=c=(int*)malloc(sizeof(int));

*a=1;*b=2,*c=3;

a=b

printf(”%d,%d,%d\n”,*a,*b,*c);

}

程序运行后的输出结果是()。

A.3,3,3

B.2,2,3

C.1,2,3

D.1,1,3

简答题官方参考答案 (由简答题聘请的专业题库老师提供的解答)
查看官方参考答案
更多“有以下程序#include<stdio.h>#include<stdlib.h>main(){int*a,*b,*c;a=b=c=(int*)m”相关的问题
第1题
# include <stdio.h> # include <stdlib.h> void f1(int * p) { p = (int *) malloc (sizeof(int) ); *p = 100; } void f2(int * &p) { p = (int *) malloc (sizeof(int) ); *p = 200; } void Destroy(int * &p) { free(p); p=NULL; } int main() { int i=1; int j=2; int * tp=&i; int * tq=&j; f1(tp); f2(tq); printf("%d\n",*tp); printf("%d\n",*tq); Destroy(tp); Destroy(tq); return 0; } 上述代码结果为

A、1 2

B、1 200

C、100 2

D、100 200

点击查看答案
第2题

#include <stdio.h> #include <stdlib.h> struct contry { int num; char name[20]; } x[5] = {1,"China", 2, "USA", 3, "France", 4, "Englan", 5, "Spanish"}; int main() { int i; for(i=0; i<5; i++) if(strcmp(x[i].name, "t")> 0) printf("%d\n", x[i].num); return 0; }

A、2

B、3

C、1 2 3 4 5

D、1

点击查看答案
第3题
?有如下程序:

include(iostream.h>

include

classTestClass

{

public:

intX,y;

TestClass(){x=y=0;}

TestClass(inta,intb){x=a;y=b;}

voiddisp()

{

cout$amp;}

};

voidmain()

{

TestClasss1(2,3);

s1.disp();

}

程序执行后的输出结果是()。

A.100

B.000

C.010

D.001

点击查看答案
第4题
下列程序的执行结果是()。 #include(iostream.h> #include classTestClass { public: intX,y; TestClass(){x=y=0;} TestClass(inta,intb){x=a;y=b;} voiddisp() { cout$amp;A.x=2,y=2

B.x=2,y=3

C.x=3,y=2

D.x=3,y=3

点击查看答案
第5题
(14)以下程序运行后的输出结果是 【14】 。

#include

#include

#include

main()

{ char *p; int i;

p=(char *)malloc(sizeof(char)*20);

strcpy(p,"welcome");

for(i=6;i>=0;i--) putchar(*(p+i));

printf("\n "); free(p);

}

点击查看答案
第6题
以下程序的执行结果是 #include <stdio.h> int main() { int a = 5, b = 4, x, y; x = 2 * a++; y = --b * 2; printf("a=%d, x=%d\n", a, x); printf("b=%d, y=%d\n", b, y); return 0; }

A、a=6, x=10 b=3, y=6

B、a=6, x=10 b=3, y=8

C、a=6, x=12 b=3, y=6

D、以上均不对

点击查看答案
第7题

调试程序,写出程序的输出结果,并解释 #include <iostream> #include <iostream> using namespace std; class complex { public: complex() { real = imag = 0.0; } complex(double r) { real = r; imag = 0.0; } complex(double r, double i) { real = r; imag = i; } friend complex operator + (const complex &c1, const complex &c2); friend complex operator - (const complex &c1, const complex &c2); friend complex operator * (const complex &c1, const complex &c2); friend complex operator / (const complex &c1, const complex &c2); friend void print(const complex &c); private: double real, imag; }; complex operator+ (const complex &c1, const complex &c2) { return complex(c1.real + c2.real, c1.imag + c2.imag); } complex operator-(const complex &c1, const complex &c2) { return complex(c1.real - c2.real, c1.imag - c2.imag); } complex operator * (const complex &c1, const complex &c2) { return complex(c1.real*c2.real - c1.imag * c2.imag, c1.real*c2.imag + c1.imag * c2.real); } complex operator/(const complex &c1, const complex &c2) { return complex((c1.real*c2.real + c1.imag * c2.imag) / (c2.real*c2.real) / (c2.real*c2.real + c2.imag*c2.imag), (c1.imag*c2.real - c1.real * c2.imag) / (c2.real)*(c2.real + c2.imag*c2.imag)); } void print(const complex &c) { if (c.imag < 0) cout << c.real << c.imag << "i"; else cout << c.real << "+" << c.imag << "i"; } int main() { complex c1(2.0), c2(3.0, -1.0), c3; c3 = c1 + c2; cout << "\ncl+c2="; print(c3); c3 = c1 - c2; cout << "\nc1-c2="; print(c3); c3 = c1 * c2; cout << "\ncl*c2="; print(c3); c3 = c1 / c2; cout << "\nc1/c2="; print(c3); c3 = (c1 + c2)*(c1 - c2) * c2 / c1; cout << "\n(c1 + c2)*(c1 - c2) * c2 / c1="; print(c3); cout << endl; return 0; }

点击查看答案
第8题
以下程序段运行后的输出结果是【1】. #include <string.h> #include <stdio.h> int main() { char s1[10]="good",s2[]="luck"; printf("%d",strlen(strcat(s1,s2))); return 0; }

A、goodluck

B、luckgood

C、8

D、9

点击查看答案
第9题
设char s1[10], *s2= “ab\0cded”, 执行strcpy(s1, s2)后,cout< <s1;的运行结果是>
点击查看答案
重要提示: 请勿将账号共享给其他人使用,违者账号将被封禁!
查看《购买须知》>>>
重置密码
账号:
旧密码:
新密码:
确认密码:
确认修改
购买搜题卡查看答案
购买前请仔细阅读《购买须知》
请选择支付方式
微信支付
支付宝支付
点击支付即表示你同意并接受《服务协议》《购买须知》
立即支付
搜题卡使用说明

1. 搜题次数扣减规则:

功能 扣减规则
基础费
(查看答案)
加收费
(AI功能)
文字搜题、查看答案 1/每题 0/每次
语音搜题、查看答案 1/每题 2/每次
单题拍照识别、查看答案 1/每题 2/每次
整页拍照识别、查看答案 1/每题 5/每次

备注:网站、APP、小程序均支持文字搜题、查看答案;语音搜题、单题拍照识别、整页拍照识别仅APP、小程序支持。

2. 使用语音搜索、拍照搜索等AI功能需安装APP(或打开微信小程序)。

3. 搜题卡过期将作废,不支持退款,请在有效期内使用完毕。

请使用微信扫码支付(元)

订单号:

遇到问题请联系在线客服

请不要关闭本页面,支付完成后请点击【支付完成】按钮
遇到问题请联系在线客服
恭喜您,购买搜题卡成功 系统为您生成的账号密码如下:
重要提示:请勿将账号共享给其他人使用,违者账号将被封禁。
发送账号到微信 保存账号查看答案
怕账号密码记不住?建议关注微信公众号绑定微信,开通微信扫码登录功能
警告:系统检测到您的账号存在安全风险

为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!

- 微信扫码关注简答题 -
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反简答题购买须知被冻结。您可在“简答题”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
- 微信扫码关注简答题 -
请用微信扫码测试
欢迎分享答案

为鼓励登录用户提交答案,简答题每个月将会抽取一批参与作答的用户给予奖励,具体奖励活动请关注官方微信公众号:简答题

简答题官方微信公众号

简答题
下载APP
关注公众号
TOP