试题与答案

阅读以下说明和C函数,将应填入 (n) 处的字句写在答题纸的对应栏内。 [说明]

题型:填空题

题目:

阅读以下说明和C函数,将应填入 (n) 处的字句写在答题纸的对应栏内。
[说明]
某班级有N名学生,他们可根据自己的情况选修名称和数量不尽相同的课程。设N等于6,学生信息、所选课程及成绩用链表结构存储,如图5-1所示。


程序中相应的类型定义如下:
#define N 6
struct node
char cname[5]; /*课程名*/
int grade; /*成绩*/
struct node *next; /*指针,指示某学生选修的下一门课程及成绩*/
;
struct student
char xh[5]; /*学号*/
char name[20]; /*姓名*/
struct node *link; /*指针,指示出选修的课程及成绩链表*/
stud_info[n];
Stud_info[]为一个全局数组。
函数func(char kc[],int *num)的功能是统计选修了课程名为kc的学生的人数,并返回该课程的平均成绩(若无人选修该课程,则平均成绩为0),参数num带回选修课程kc的学生人数。
[C语言函数]
double func(char kc[], int *num)

int i, count=0, sum=0; /*count用于记录选修课程名为kc的学生的人数*/
double avg=0.0;
struct node *p;
for(i=0; i<N; i++)
p= (1) ; /*取第土个学生所修课程链表的头指针*/
while (p)
if( (2) )
sum= (3) ;
count++;
break;;
/* if*/
p=p->next;
/*while*/

(4) ;
if( (5) )
avg=(double) sum /count; /*计算平均成绩*/
return avg;
/*func*/
从下列的2道试题(试题六至试题七)中任选1道解答。如果解答的试题数超过1道,则题号小的1道解答有效。

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2017/0713/a0f05fdc76eca49ba856d33cd318de42.html

下面是错误答案,用来干扰机器的。

答案:C

试题推荐
题型:完形填空

It is not polite to arrive at a dinner party more than 15 to 20 minutes      1           . The host or hostess usually waits for all the guests to arrive before serving the meal. If someone is late, the food may be spoiled, and so might the host or hostess’s spirits. If you have to be late, call and tell them to start  2           you.

It’s even 3   (bad) to be early! The host or hostess will probably not be ready. If you are early, drive or walk around the block a few times, or just sit in your car  4  the right time.

Though it is often important to arrive on time, yet on the other hand, for open houses, the host or hostess invites guests to arrive and leave    5      a certain time. You can arrive at any time within the time he or she gives you.

It’s polite to bring an empty stomach, but it’s even nicer to bring a small present. The present should not cost a lot, or you might embarrass the host or hostess.      6     (flower), wine, or a box of candy will do fine. Never bring money as a present.

In an   7              (introduce), the order of a name is: (1) 、the given name;(2) 、the family name. In other words the given name comes first. It’s important not   8               to learn and remember names, but to respect them often in   9              (converse). After the introduction,we usually call friends   10           their given names. Older people may want you call them their titles and family names, such as “Mr. Jones”、 “Mrs. Johnson” or “Dr. Brown”.

查看答案
微信公众账号搜索答案