题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-11-10 18:59:19

[简答题]学生的记录由学号和成绩组成,N名学生的数据已在主函数中放入结构体数组s中,请编写函数fun( ),它的功能是按分数的高低排列学生的记录,低分在前。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
#include <stdio.h>
#define N 16
typedef struct

char mum[10);
int s;
STREC;
int fun (STREC a[ ])

main ( )

STREC s[N]="GA005",88,"GA003",64,
"CA002",77,"GA004",89,"GA001",54,
"GA007",72,"GA008",72,"GA006",65,
"GA015",83,"GA013",95,"GA012",55,
"GA014",68,"GA011",78,"GA017",53,
"GA018",92,"GA016",82;
int i;
FILE *out;
fun(s);
printf("The data after sorted :/n");
for(i=0;i<N;i++)

if((i)%4==0)
/*每行输出4个学生记录*/
printf("/n");
printf("%s %4d",s[i].num,s[i].s);

printf("/n");
out=fopen("out21.dat","w");
for(i=0;i<N;i++)

if((i)%4==0&&i)
fprintf(out,"/n");
fPrintf(out,"%4d",s[i].s);

fprintf(out,"/n");
f

更多"学生的记录由学号和成绩组成,N名学生的数据已在主函数中放入结构体数组s"的相关试题:

[简答题]学生的记录由学号和成绩组成,N名学生的数据已在主函数中放入结构体数组s中,请编写函数fun( ),该函数的功能是:把高于等于平均分的学生数据放在b所指的数组中,低于平均分的学生数据放在c所指的数组中,高于等于平均分的学生人数通过形参n传回,低于平均分的学生人数通过形参m传回,平均分通过函数值返回。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。 试题程序: #include <stdio.h> #define N 12 typedef struct { char num[10]; double s; } STREC; double fun(STREC *a,STREC *b,STREC *c,int *n,int *m) { } main( ) { STREC s[N]={{"GA05",65},{"GA03",86}, {"GA02",76},{"GA04",95},{"GA01",93}, {"GA07",78},{"GA08",68},{"GA06",88}, {"GA09",60},{"GA11",54},{"GA12",56}, {"GA10",98}}; STREC h[N],l[N],t; FILE *out; int i,j,m,n; double ave; ave=fun(s,h,l,&n,&m); printf("The %d student data which is higher than %7.3f:/n",n,ave); for(i=0;i<n;i++) printf("%s %4.lf/n",h[i].num, h[i].s); printf("/n"); printf("The %d Student data which iS lower than%7.3f:/n",m,ave); for(i=0;i<m;i++) printf("%s %4.1f/n",l[i].num, l[i].s); printf("/n"); out=fopen("out26.d
[简答题]学生的记录由学号和成绩组成,N名学生的数据已在主函数中放入结构体数组S中,请编写函数fun,其功能是:把低于平均分的学生数据放入b所指的数组中,低于平均分的学生人数通过形参n传回,平均分通过函数值返回。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入你编写的若干语句。
试题程序:
#include<stdio.h>
#define N 8
typedef struct

char num[10];
double s;
STREC;
double fun(STREC*a,STREC*b,int*n)


void main( )

STREC s[N]="GA05",85,"GA03",76,"GA02",69,"GA04",85,"GA01",91,"GA07",72,"GA08",64,"GA06",87;
STREC h[N];
int i,n;
double ave;
ave=fun(s,h,&n);
printf("The%d student data which is lower
than%7.3f:/n"
n,ave);
for(i=0;i<n;i++)/*输出成绩低于平均值的学生记录*/
printf("%s%4.1f/n",h[i],num,h[i],s;
printf("/n");

[简答题]学生的记录由学号和成绩组成,N名学生的数据已在主函数中放入结构体数组s中,请编写函数fun( ),它的功能是:把指定分数范围内的学生数据放在b所指的数组中,分数范围内的学生人数由函数值返回。 例如,输入的分数是60和69,则应当把分数在60到69的学生数据进行输出,包含60分和69分的学生数据。主函数中把60放在low中,把69放在heigh中。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。 试题程序: #include <stdio.h> #define N 16 typedef struct { char num[10]; int s ; } STREC; int fun (STREC *a, STREC *b, int 1, int h ) { } main ( ) { STREC s [N] ={ { "GA005", 85 }, { "GA003", 76 }, { "GA002", 69}, { "GA004", 85}, { "GA001", 96 } , { "GA007", 72}, { "GA008", 64}, { "GA006", 87 } , { "GA015", 85}, { "GA013", 94}, { "GA012", 64 } , { "GA014", 91}, { "GA011", 90}, { "GA017", 64 } , { "GA018", 64 } , { "GA016", 72 } }; STREC h [N], tt; FILE *out; int i, j, n, low, heigh, t; printf("Enter 2 integer number low & heigh: "); scanf ("%d%d ", &low, &heigh); if (heigh<low) {t=heigh;heigh=low; low=t; } n=fun (s,h, low, heigh); printf ("The student’s data b
[简答题]学生的记录由学号和成绩组成,N名学生的数据已在主函数中放入结构体数组s中,请编写函数fun,它的功能是:按分数的高低排列学生的记录,高分在前。
注意:部分源程序在文件PROG1.C中,请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入你编写的若干语句。
文件PROG1.C的内容如下:
#include<stdio.h>
#define N 16
typedef struct
char num[10];
int s;
STREC;
void fun(STREC a[])


void main( )
STREC s[N]="GA005",85,"GA003",76,"GA002",69,"GA004",85,
"GA001",91,"GA007",72,"GA008",64,"GA006",87,
"GA015",85,"GA013",91,"GA012",64,"GA014",92,
"GA011",66,"GA017",65,"GA018",68,"GA016",72;
int i:
fun(s);
printf("The data after sorted: /n");
for(i=0;i<N;i++)
if(i%4==0)printf("/n");
printf("%s%4d",s[i].num,s[i].s):
printf("/n");

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码