题目内容 (请给出正确答案)
[单选题]

下面程序的输出结果是 #include <stdio.h> int main() { union { int i[2]; int k; int c; }t,*s = &t; s->i[0] = 10; s->i[1] = 20; s->k=30; printf("%d\n", s->k); printf("%d\n", s->i[0]); printf("%d\n", s->c); return 0; }

A.30 30 30

B.10 20 30

C.30 10 随机数

D.30 10 20

提问人:网友wav1314 发布时间:2022-01-07
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
网友答案
查看全部
  • · 有5位网友选择 D,占比25%
  • · 有3位网友选择 D,占比15%
  • · 有3位网友选择 A,占比15%
  • · 有2位网友选择 B,占比10%
  • · 有2位网友选择 A,占比10%
  • · 有2位网友选择 B,占比10%
  • · 有2位网友选择 C,占比10%
  • · 有1位网友选择 C,占比5%
匿名网友 选择了D
[147.***.***.253] 1天前
匿名网友 选择了C
[44.***.***.186] 1天前
匿名网友 选择了A
[32.***.***.86] 1天前
匿名网友 选择了D
[240.***.***.134] 1天前
匿名网友 选择了D
[156.***.***.150] 1天前
匿名网友 选择了B
[69.***.***.247] 1天前
匿名网友 选择了D
[228.***.***.120] 1天前
匿名网友 选择了D
[74.***.***.85] 1天前
匿名网友 选择了A
[199.***.***.173] 1天前
匿名网友 选择了B
[171.***.***.22] 1天前
匿名网友 选择了B
[127.***.***.84] 1天前
匿名网友 选择了A
[160.***.***.203] 1天前
匿名网友 选择了D
[132.***.***.116] 1天前
匿名网友 选择了C
[31.***.***.201] 1天前
匿名网友 选择了D
[136.***.***.241] 1天前
匿名网友 选择了A
[166.***.***.254] 1天前
匿名网友 选择了D
[211.***.***.245] 1天前
匿名网友 选择了A
[123.***.***.229] 1天前
匿名网友 选择了B
[181.***.***.229] 1天前
匿名网友 选择了C
[117.***.***.250] 1天前
加载更多
提交我的答案
登录提交答案,可赢取奖励机会。
更多“下面程序的输出结果是 #include ...”相关的问题
第1题
下面程序的输出结果是( )。 #include <stdio.h> int num=10; int func() { int num=4; return ++num; } void main() { printf("%d\n",func()); }

A、4

B、5

C、10

D、11

点击查看答案
第2题
如下程序的输出结果是______。

include<iostream>

using namespace std;

int funl(int x){return++x;}

int fun2(int&x){return++x;}

int main(){

int x:1,y=2;

Y=funl(fun2(x));

cout<<x<<','<<y;

return 0;

}

点击查看答案
第3题
请阅读下述代码,写出程序执行的结果

#include

using namespace std;

class CBase

{

public:

virtual void print()

{

cout$amp; }

void DoPrint()

{

print();

}

};

class CChild1: public CBase

{

public:

virtual void print()

{

cout$amp; }

};

class CChild2: pu

{

public:

virtual void pri

{

cout$amp; }

};

void DoPrint(CB

{

base->DoPrint

}

void main()

{

CBase* base =

CChild1* child

CChild2* child

DoPrint(child1

DoPrint(child2

DoPrint(base);

delete base;

base = child1;

base->print();

delete child1;

delete child2;

}

点击查看答案
第4题
有如下程序 #include <iostream> using namespace std; int max(int x,int y) { int z; if(x>y) z=x; else z=y; return z; } int main() { int a=3,b=5; cout<<"max="<> < <endl;> A、max=3

B、max=4

C、max=5

D、max=6

点击查看答案
第5题
定义char s[4]={"Max"},t; 执行下面语句段后输出结果是 t=s[0];s[0]=s[1];s[1]=s[2]; s[2]=s[3]; s[3]=t; printf("%s,%c \n", s, s[3]);

A、axM,\0

B、axM,M

C、ax M,M

D、ax,M

点击查看答案
第6题
下列程序的输出结果是: include <iostream> using namespace std; class Base { public: void print ( ) { cout << 'B'; } }; class Derived : public Base { public: void print ( ) { cout << 'D'; } }; int main( ) { Derived * pd = new Derived( ); Base * pb = pd; pb->print( ); pd->print( ); delete pd; return 0; }

A、BD

B、BB

C、DD

D、DB

点击查看答案
第7题
下列程序的运行结果为( )。 char str[ ]= "abc",*p=str; cout<<*(p+2);<br> A、67

B、0

C、字符c的地址

D、c

点击查看答案
第8题
下面程序的输出结果是()。 include<stdio.h> main() {static chara[]="zhao",b[]="juan"; char*ptr1=a,*ptr2=b; int k; for(k=0;k<4;k++) if(*(ptr1+k)==*(ptr2+k)) printf("%c",*(ptr1+k));}
点击查看答案
第9题
设某大学有下列登记表,下面哪个选项采用了最佳方式对它进行类型定义。

A、#include <stdio.h> struct date /* 定义日期结构体类型 */ { int year; /* 年 */ int month; /* 月 */ int day; /* 日 */ }; struct professionalState /* 定义职业结构体类型 */ { char college[80]; /* 所在学院*/ char professionalTitle[20]; /* 职称 */ char duty[20]; /* 职务 */ }; struct person /* 定义职工个人信息结构体类型 */ { char name[20]; /* 姓名 */ char sex; /* 性别 */ struct date birthday; /* 出生日期 */ struct professionalState occupation; /* 职业状况 */ }; int main() { ...... return 0; }

B、#include <stdio.h> struct date /* 定义日期结构体类型 */ { int year; /* 年 */ int month; /* 月 */ int day; /* 日 */ }; struct professionalState /* 定义职业结构体类型 */ { char college[80]; /* 所在学院*/ char professionalTitle[20]; /* 职称 */ char duty[20]; /* 职务 */ }; int main() { char name[20]; /* 姓名 */ char sex; /* 性别 */ struct date birthday; /* 出生日期 */ struct professionalState occupation; /* 职业状况 */ ...... return 0; }

C、#include <stdio.h> struct date /* 定义日期结构体类型 */ { int year; /* 年 */ int month; /* 月 */ int day; /* 日 */ }; int main() { char name[20]; /* 姓名 */ char sex; /* 性别 */ struct date birthday; /* 出生日期 */ char college[80]; /* 所在学院*/ char professionalTitle[20]; /* 职称 */ char duty[20]; /* 职务 */ ...... return 0; }

D、#include <stdio.h> int main() { char name[20]; /* 姓名 */ char sex; /* 性别 */ char college[80]; /* 所在学院*/ char professionalTitle[20]; /* 职称 */ char duty[20]; /* 职务 */ int year; /* 年 */ int month; /* 月 */ int day; /* 日 */ ..... return 0; }

E、#include <stdio.h> struct date /* 定义日期结构体类型 */ { int year; /* 年 */ int month; /* 月 */ int day; /* 日 */ }; union professionalState /* 定义职业共用体类型 */ { char college[80]; /* 所在学院*/ char professionalTitle[20]; /* 职称 */ char duty[20]; /* 职务 */ }; struct person /* 定义职工个人信息结构体类型 */ { char name[20]; /* 姓名 */ char sex; /* 性别 */ struct date birthday; /* 出生日期 */ union professionalState occupation; /* 职业状况 */ }; int main() { ...... return 0; }

点击查看答案
账号:
你好,尊敬的用户
复制账号
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
欢迎分享答案

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

简答题官方微信公众号

警告:系统检测到您的账号存在安全风险

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

微信搜一搜
简答题
点击打开微信
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反简答题购买须知被冻结。您可在“简答题”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
微信搜一搜
简答题
点击打开微信