600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > 201约花鸟画 考c语言试题 全国计算机二级C语言上机100题..doc

201约花鸟画 考c语言试题 全国计算机二级C语言上机100题..doc

时间:2023-08-31 17:02:12

相关推荐

201约花鸟画 考c语言试题 全国计算机二级C语言上机100题..doc

上 机 题 库

第一部分 填空题

?????????????????????????????????????????????????????????????

注意:源程序存放在考生文件夹下的BLANK1.C中。

不得增行或删行,也不得更改程序的结构!

请在程序下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。

?????????????????????????????????????????????????????????????

给定程序中,函数FUN的功能是:计算出带有头接点的单向链表中各结点数据域之和作为函数值返回。

#include

#include

#define N 8

typedef struct list

{ int data;

struct list *next;

} SLIST;

SLIST *creatlist(int *);

void outlist(SLIST *);

int fun( SLIST *h)

{ SLIST *p; int s=0;

p=h->next;

while(p)

{

/**********************************found*********************************/

s+= p->___1___; data

/**********************************found*********************************/

p=p->___2___; next

}

return s;

}

main( )

{ SLIST *head;

int a[N]={12,87,45,32,91,16,20,48};

head=creatlist(a); outlist(head);

/**********************************found*********************************/

printf("\nsum=%d\n", fun(___3___)); head

}

SLIST *creatlist(int a[ ])

{ SLIST *h,*p,*q; int i;

h=p=(SLIST *)malloc(sizeof(SLIST));

for(i=0; i

{ q=(SLIST *)malloc(sizeof(SLIST));

q->data=a[i]; p->next=q; p=q;

}

p->next=0;

return h;

}

void outlist(SLIST *h)

{ SLIST *p;

p=h->next;

if (p==NULL) printf("The list is NULL!\n");

else

{ printf("\nHead ");

do

{ printf("->%d", p->data); p=p->next; }

while(p!=NULL);

printf("->End\n");

}

}

给定程序中,函数FUN的功能是:求出形参SS所指字符串数组中最长字符串的长度,其余字符串左边用字符*补齐,使其与最长的字符串等长。字符串数组中工有M个字符串,且串长

#include

#include

#define M 5

#define N 20

void fun(char (*ss)[N])

{ int i, j, k=0, n, m, len;

for(i=0; i

{ len=strlen(ss[i]);

if(i==0) n=len;

if(len>n) {

/**********************************found*********************************/

n=len; k=___1___; i

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。