首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下列程序中函数fun的功能是:统计person所指结构体数组中所有性别(sex)为M的记录的个数,存入变量n中,并作为函数值返回。请填空。 #include <stdio.h> #define N 3 typedef st
下列程序中函数fun的功能是:统计person所指结构体数组中所有性别(sex)为M的记录的个数,存入变量n中,并作为函数值返回。请填空。 #include <stdio.h> #define N 3 typedef st
admin
2009-08-24
26
问题
下列程序中函数fun的功能是:统计person所指结构体数组中所有性别(sex)为M的记录的个数,存入变量n中,并作为函数值返回。请填空。
#include <stdio.h>
#define N 3
typedef struct
{ int num; char nam[10]; char sex;} SS;
int fun(SS person[])
{ int i,n=0;
for(i=0; i<N; i++)
if(【 】==’M’) n++;
return n;
}
main()
{ SS W[N]={{1,"AA",’F’},{2,"BB",’M’},{3,"CC",’M’}}; int n;
n=fun(W); printf("n=%d\n", n);
}
选项
答案
person[i].sex
解析
本题考查的是对结构体成员的引用,对结构体数组成员的访问是以数组元素为结构体变量的,其形式为结构体数组元素咸员名,所以题目空白处应填person
.sex。
转载请注明原文地址:https://jikaoti.com/ti/ZbI0FFFM
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
以下关于菜单的叙述中错误的是
在窗体上画一个名称为Command1的命令按钮,并编写如下事件过程:PrivateSubCommandl_Click()x=1s=0Fori=1To5x=x/iS=S+XNext
在考生文件夹下有一个工程文件sjt3.vbp。程序的功能是通过键盘输入正整数到文本框中。在“除数”框架中选择一个单选按钮,然后单击“处理数据”命令按钮,将大于文本框中的正整数,并且能够被所选除数整除的5个数添加到列表框Listl中,如图所示。在窗体文件中已
下列叙述中正确的是
以下关于VB文件的叙述中,正确的是
通常软件测试实施的步骤是()。
在窗体(名称为Form1)上画一个名称为Text1的文本框和一个名称为Commandl的命令按钮,然后编写一个事件过程。程序运行后,如果在文本本框中输入一个字符,则把命令按钮的标题设置为“计算机等级考试”。以下能实现上述操作的时间过程是
下面不属于需求分析阶段任务的是
定义部门关系模式如下:部门(部门号。部门名,部门成员,部门总经理),使它不满足第一范式的属性是()。
下面不属于软件需求分析阶段主要工作的是
随机试题
在公共组织中,公共政策学研究对象的核心和重点是()
茅盾的作品不包括()
Itisphysicallyimpossibleforawall-educatedintellectual,orabravemantomakemoneythechiefobjectofhisthoughts;as
乳牙的大面积龋坏,不但会使牙弓长度减小,还会影响颌间高度,为确保乳牙正常宽度和高度,对于多个牙面龋坏的牙齿,应该使用
病人王某,男,75岁,因糖尿病并发酮症酸中毒而收入院,尿糖(++++),酮体(++++)。医嘱:皮下注射胰岛素。如果该病人需长期注射胰岛素,在注射前要特别注意()
会计人员如果泄露本单位的商业秘密,可能导致的后果将会是()。
为了加强对产品质量的监督管理,提高产品质量水平,明确产品质量责任,保护消费者的合法权益,维护社会经济秩序,1993年2月22日我国第七届全国人民代表大会常务委员会第三三十次会议于通过了《中华人民共和国产品质量法》,自1993年9月1日起施行。为了加强质量管
在窗体上画一个名称为List1的列表框,一个名称为Label1的标签。列表框中显示若干城市的名称。当单击列表框中的某个城市名时,在标签中显示选中城市的名称。下列能正确实现上述功能的程序是______。
以下程序设计语言是低级语言的是()。
Mostpeoplehavenoideaofthehardworkandworrythatgointothecollectingofthosefascinatingbirdsandanimalsthatthey
最新回复
(
0
)