云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 二级C语言真题2017年09月-(1)及答案解析

二级C语言真题2017年09月-(1)及答案解析

  • 62 次阅读
  • 3 次下载
  • 2026/1/10 0:42:33

{

char name[50]; double price; }BOOK;

void fun(BOOK *pd,int num,int size); void main() {

BOOK data[10]={\计算机原理\数据结构\int n=3,m=10; fun(data,n,m);

printf(\}

void fun(BOOK*pd,int num,int size) {

int i,j,t;

double mx,mn;

mx=mn=pd[0].price; j=t=0;

for(i=1;i<nun;i++) {

if(pd[i].price>mx) { mx=pd[i].price;j=i;} if(pd[i].price<mn) {mn=pd[i].price;t=i;} }

pd[size-2]=pd[j]; pd[size-1]=pd[t]; }

程序的运行结果是______。 A.数据结构,计算机原理 B.计算机原理,数据结构 C.photoshop,计算机原理 D.数据结构,photoshop 上一题 下一题 (40/40)单项选择题 第40题

有下列程序:

#include<stdio.h> #include<string.h> typedef struct stu{ char name[9]; char gender; int score; }STU;

void f(STU *a)

{STU c={\a=d;

strcpy(a->name,c.name); a->gender=c.gender; a->score=c.score:

printf(\>name,a->gender,a->score); }

main()

{STU a={\f(&a);

printf(\}

程序执行后的输出结果是______。 A.Zhao,m,85,Sun,f,90 B.Sun,f,90,Sun,f,90 C.Sun,f,90,Zhao,m,85 D.Zhao,m,85,Zhao,m,85 上一题 下一题 (1/1)程序填空题 第41题

下列给定程序中已建立一个带头节点的单向链表,链表中的各节点按节点数据域中的数据递增有序链接。函数fun的功能是:把形参x的值放入一个新节点并插入链表中,使插入后各节点数据域中的数据仍保持递增有序。

请在程序的下划线处填入正确的内容,使程序得出正确的结果。 注意:部分源程序给出如下。

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

#include<stdio.h> #include<stdlib.h> #define N 8

typedef struet list { int data;

struet list *next; }SLIST;

void fun(SLIST *h,int x) { SLIST *p,*q,%s;

s=(SLIST *)malloe(sizeof(SLIST)); /********found********/ s->data=______; q=h;

p=h->next;

while(p!=NULL&&x>p->data){ /********found********/

q=______;

p=p->next; }

s->next=p;

/********found********/ q->next=______; }

SLIST *creatlist(int *a) { SLIST *h,*p,*q;int i;

h=p=(SLIST *)malloc(sizeof(SLIST)); for(i=0;i<N;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(\else

{ printf(\

do {printf(\>%d\>data); p=p->next; }while(p!=NULL);

printf(\>End\\n\} }

main()

{ SLIST *head; int x;

int a[N]={11,12,15,18,19,22,25,29}; head=creatlist(a);

printf(\outlist(head);

printf(\scanf(\fun(head,x);

printf(\outlist(head); }

上一题 下一题 (1/1)程序改错题 第42题

下列给定程序中函数fun的功能是:计算正整数nun各位上的数字之积。 例如,若输入252,则输出应该是20。若输入202,则输出应该是0。 请改正程序中的错误,使它能得出正确的结果。

注意:不要改动main函数,不得增行或删行,也不得更改程序的结构! 试题程序:

#include<stdio.h> #include<conio.h> long fun(10ng num) {

/********found********/ long k; do {

k*=num;

/********found********/ num\\=10; }while(num); return(k); }

main() {

long n;

printf(\seanf(\

printf(\}

上一题 下一题 (1/1)程序设计题 第43题

编写函数fun,其功能是:计算n门课程的平均分,结果作为函数值返回。

例如,若有5门课程的成绩是:90.5,72,80,61.5,55,则函数的值为71.80。 注意:部分源程序给出如下。

请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入你编写的若干语句。 试题程序:

#include<stdio.h> float fun(float *a,int n) { }

  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

{ char name[50]; double price; }BOOK; void fun(BOOK *pd,int num,int size); void main() { BOOK data[10]={\计算机原理\数据结构\int n=3,m=10; fun(data,n,m); printf(\} void fun(BOOK*pd,int num,int size) { int i,j,t; double mx,mn; mx=mn=pd[0].price; j=t=0; for(i=1;i<nun;i++) { if(pd[i].price>mx) { mx=pd[i].price;j=i;} if(pd[i].price<mn) {m

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com