全球旧事资料 分类
r
【习题9023】结构体类型定义如下:r
structdatei
tyeari
tmo
thi
tday定义日期结构体类型r
structstude
tr
char
ame20r
structdatebirth出生日期r
r
结构体数组s存储了
个人的名字和出生日期。写一函数,求这
个人中年龄最大r
(即出生日期最小)者的姓名。r
r
charoldeststude
tsi
t
r
i
tjk0r
forj1j
1jr
ifskbirthyearsjbirthyearkjr
elseifskbirthyearsjbirthyearr
ifskbirthmo
thsjbirthmo
thkjr
elseifskbirthmo
thsjbirthmo
thr
ifskbirthdaysjbirthdaykjr
r
r
retur
sk
amer
r
r
r
【习题9033】日期和链表结点的结构体类型定义如下:r
structdatei
tyeari
tmo
thi
tday日期结构体类型r
structstude
tNode链表结点的结构体类型r
char
ame10人名r
structdatebirth出生日期r
structstude
tNode
extr
r
结构体链表L存储了
个人的名字和出生日期。写一函数,求这
个人中r
年龄最大(即出生日期最小)者的名字。r
r
charoldeststructstude
tNodeLr
若L是空表,则返回空指针
ullr
否则返回表中年龄最大者的名字r
r
structstude
tNodepr
r
ifLNULLretur
NULLr
forpL
extpNULLpp
extr
r
ifpbirthyearLbirthyearco
ti
uer
ifpbirthyearLbirthyearr
r
ifpbirthmo
thLbirthmo
thco
ti
uer
ifpbirthmo
thLbirthmo
thpbirthdayLbirthdayco
ti
uer
r
Lpr
r
retur
L
amer
r
r
r
r
【习题9063】结构体类型定义如下:r
structcourser
i
tcID课程号,取值099r
char
ame10课程名r
floatcredit学分,取值05r
i
tsemester学期,取值18r
r
结构体数组c存储了
门课程的信息。写一函数,求学期s的总学分。r
r
floatcreditSumstructcourseci
t
i
tsr
i
tifloatsum00r
fori0i
ir
ifcisemesterssumcicreditr
retur
sumr
r
r
r
【习题9073】课程链表结点的结构体类型定义如下:r
structcourseNode课程链表结点的结构体类型r
i
tcID课程号,取值099r
char
ame10课程名r
floatcredit学分,取值05r
i
tsemester学期,取值18r
structcourseNode
extr
r
结构体链表Lc存储了各学期多门课程的信息。写一函数,求学r
期s的总学分。r
r
floatcreditSumstructcourseNodeLci
tsr
若Lc是空表,则返回0r
否则返回学期s的总学分r
r
structcor
好听全球资料 返回顶部