题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-11-15 23:11:38

[简答题]编写程序,学生的记录由学号和成绩组成,学生用结构体表示,按学号由小到大输入10个学生的成绩,按分数降序排列该组学生。

更多"编写程序,学生的记录由学号和成绩组成,学生用结构体表示,按学号由小到大"的相关试题:

[简答题]学生的记录由学号和成绩组成,M名学生的数据已在主函数中放入结构体数组stu中,请编写函数proc( ),该函数的功能是:把高于等于平均分的学生数据放在b所指的数组中,高于等于平均分的学生人数通过形参n传回,平均分通过函数值返回。
注意:部分源程序已给出。
请勿改动主函数main和其他函数中的任何内容,仅在函数proc的花括号中填入所编写的若干语句。
试题程序:
#include<stdio.h>
#define M 12
typedef struct
char num[10];
double s;
STREC;
double proc(STREC*a,STREC*b,int*n)


void main( )

STREC stu[M]=f"GA05",85,"GA03",76,
"GA02",69),"GA04",85,"GA01",91,
"GA07",72),"GA08",64,"GA06",87,
"GA09",60,"GA11",79),("GA12",73,
"GA10",90;
STREC h[M];
int i,n;
double ave;
ave=proc(stu,h,&n);
printf("The%d student data which is higher 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名学生的数据已存入a结构体数组中。请编写函数fun( ),该函数的功能是:找出成绩最低的学生记录,通过形参返回主函数(规定只有一个最低分)。己给出函数的首部,请完成该函数。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。 试题程序: #include<stdio. h> #include<string. h> #include<aonio .h> #define N 10 typedef struct ss { char num[10]; iht s; } STU; fun(STU ail, STU *s) { } main( ) { STU a[N]={ {"A01",81}, {"A02",89}, { "A03", 66 }, { "A04", 87 }, { "A05", 77 }, { "A06", 90 }, { "A07", 79}, { "A08", 61 }, { "A09", 80 ), { "Al 0", 71 } }, m; int i; clrscr 0; printf ("*****The original data*****"); for (i=0; i<N; i++) printf ("No=%s Mark=%d/n", ail] .num, a[i] .s); fun (a, &m); printf ("*****THE RESULT*****/n"); printf ("The lowest :%s, %d/n",m.num, m.s); }
[简答题]学生的记录由学号和成绩组成,N名学生的数据已在主函数中放入结构件数组s中,请编写函数fun( ),它的功能是:把分数最高的学生数据放在h所指的数组中。注意:分数高的学生可能不只一个,函数返回分数最高学生的人数。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。 试题程序: #include <stdio.h> #define N 16 typedef struct { char num[10]; int s; }STREC; int fun(STREC *a,STREC *b) { } 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", 91 ), { "GA011", 66}, { "GA017", 64 }, {"GA018", 64 }, {"GA016", 72 } }; STREC h[N]; int i, n; FILE *out; n=fun(s,h); printf("The %d highest score :/n",n); for (i=0; i<n; i++) printf("%s %4d/n ",h[i].num, h[i].s); /*输出最高分学生的学号和成绩* / printf("/n"); out=fopen("out45.dat", "w"); fprintf(out, "%d/n",n); for(i=0; i<n; i++) fprintf(out, "%4d/n ",h[i].s); fclose(out); }
[简答题]学生的记录由学号和成绩组成,N名学生的数据已在主函数中放入结构体数组s中,请编写函数fjun( ),该函数的功能是:把高于等于平均分的学生数据放在b所指的数组中,高于等于平均分的学生人数通过形参n传回,平均分通过函数值返回。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
#include <stdio.h>
#define N 12
typede f struct
char num[10];
double s;
STREC;
double fun (STREC *a,STREC *b, int *n)


main ( )
STREC s IN] = "GA05", 85 , "GA03", 76 ,
"GA02", 69, "GA04", 85, "GA01", 91,
"GA07", 72, "GA08", 64, "GA06", 87,
"GA09", 60, "GAll", 79 , "GA12", 73,
"GA10", 90 ;
STREC h[N],t;
FILE *out;
int i ,j,n;
double ave;
ave=fun (s, h, &n);
printf("The %d student data which is
higher than %7.3f: In", n, ave);
for(i=0; i<n; i++)
printf ("%s %4.1f/n",h[i] .num, h[i] .s);
printf ("/n");
out=fopen ("out90.dat", "w");
fprintf(out, "%dkn %7.3f/n",n,ave);
for(i=0; i<n-1; i++)
for (j=i+l; j<n; j ++)

[简答题]下列程序的功能是:已知学生的记录由学号和三门学习成绩构成,N名学生的数据已有入 A数组中。找出各科及格的学生中总成绩最高的学生记录(假定最高成绩的记录中唯一的),通过形参返回。
请考生编写函数mmm(STUa[],STU*s)实现程序的要求,最后调用函数readwritedat( )把结果输出到文件out.dat中。
例如:
KS01 87 60 88
KS09 97 59 99
KS11 67 67 60
则调用该函数后,输出
the top:KS01,87, 60, 88
# include <stdio.h>
# include <string.h>
# define N 10
void readwritedat ( );
typedef struct ss
char num[10];
int s1, s2, s3;
STU;
mmm(STU a[],STU *s)


main ( )

STU a[N]=
"01", 81, 93, 92,
"02", 89, 65, 91,
"03", 66, 55, 73,
"04", 87, 91, 99,
"05", 77, 65, 91,
"06", 90, 55, 73,
"07", 79, 65, 91,
"08", 61, 55, 73,
"09", 80, 93, 92,
"10", 71, 65, 91
m;
int i;
for (i=0; i<N; i++ )
printf ("No=%s Mark=%d/n",a[i] .num, a[i] .s1,a[i] .s2,a[i].s3);
mmm (a, &m);
printf("the highest: %s,%d/n",m.num,m.s1+
[简答题]学生的记录由学号和成绩组成,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], t; FILE *out;
int i, j, n;
double ave;
ave=fun(s, h, &n);
printf("The %d student data which is lower than %7.3 f:/n", n, ave);
for(i=0; i<n; i++)
printf("%s %4.1f/n", h[i]. num, h[i].s);
printf("/n");
out=fopen("out.dat", "W");
fprintf(out, "%d/n%7.3f/n", n, ave);
for(i=0; 2<n-1; i++)
for(j=i+1; j<n; j++)
if(h[i]. s>h[j].s)

t=h[i];
h[i]=h[j];
h[j]=t;

for(i=0; 2<n
[填空题]在成绩表中,将所有记录先按课程号升序排序,再按分数降序排序的命令是 SELECT*FROM 成绩表 ORDER BY 【8】
[简答题]

下列程序的功能是:已知学生的记录由学号和学习成绩构成,N名学生的数据已存入数组a中,找出成绩最高的学生的记录(假定最高成绩记录是唯一的),通过形参返回。请编写函数mmm(STU a[],STU*s)实现程序要求,最后调用函数reawriteDAT( )把结果输出到文件out.dat中。
例如:KS01 87
KS09 67
KS11 97
则调用该函数后将输出:
The lowest:KS09,67
注意:部分源程序已给出。
请勿改动主函数main( )和函数readwriteDAT( )的内容。
[试题源程序]
#include<Stdio.h>
#include<string.h>
#include<conio.h>
#defime N 10
void readwriteDat( );
typedef struct ss

char num[10];int s;
STU;
void mmm(STU a[],STU*s)


msin( )

STU
a[N]="A01",81,"A02",89),"A03",81),"A01",66),"A04",87),"A05",77),"A07",79),"A08",61),"A09",80,"A10",71,),m;
int i;
System("cls");
printf("***** The original data ***** /n");
for(i=0;i<N;i++) printf("No=%s Mark=%d/n",a[i].num,a[i].s);
mmm(a,&m);
print

[简答题]

下列程序的功能是:已知学生的记录由学号和学习成绩构成,N名学生的数据已存入a数组中。找出成绩最高的学生记录(假定最高成绩的记录是唯一的),通过形参返回。请编写函数mmm(STU a[],STU*s)实现程序要求,最后调用函数reawriteDAT( )把结果输出到文件out.dat中。
例如:KS01 87
KS09 67
KS11 97
则调用该函数后,输出The lowest:KS09,67。
注意:部分源程序已给出。
请勿改动主函数main( )和函数readwriteDAT( )的内容。
[试题源程序]
#include<stdio.h>
#include<string.h>
#include<conio.h>
#define N 10
void readwriteDat( );
typedef struct ss
{
char num[10];int s;
STU;
void mmm(STU a口,STU*s)
{
}
main( )
{
STU a[N]="A01",81,"A02",89,"A03",81),"A04",66),"A05",87),"A06",77),"A07",79,
"A08",61,"A09",80),"A10",71),,m;
int i;
system("cls");
printf("*****The original data*****/n");
for(i=0;i<N;i++)printf("No=%s Mark=%d/n",a[i]nmu/n,a[i].s);
mmm(a,&m);
printf("

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

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


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",91,"GA011",66,"GA017",64,"GA018",64,"GA016",72;
STREC h[N];
int i,n;
n=fun(s,h);
printf("The%d highest score:/n",n);
for(i=0;i<n;i++)
printf("%s%4d/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");

[简答题]学生的记录由学号和成绩组成,N名学生的数据己在主函数中放入结构体数组s中,请编写函数fun( ),它的功能是:把分数最低的学生数据放在h所指的数组中。注意:分数低的学生可能不只一个,函数返回分数最低学生的人数。
注意:部分源程序给出如下。
 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序: 
#include <stdio.h>
  #define N 16
  typedef struct
  char num[10];   
int s;
 STREC;
int fun (STREC *a,STREC *b)
main ( )

STREC s[N]="GA005",82,"GA003",75,
"GA002",85,"GA004",78,"GA001",95,
"GA007",62,"GA008",60,"GA006",85,
"GA015",83,"GA013",94,"GA012",78,
"GA014",97,"GA011",60,"GA017",65,
"GA018",60,"GA016",74;
STREC h[N];
int i,n;
FILE *out;
n=fun(s,h);
printf("The %d lowest score:/n",n);
for (i=0;i<n;i++)
printf("%s %4d/n",h[i].mum,h[i].s);
/*输出最低分学生的学号和成绩*/
printf("/n");
out=fopen("out19.dat","w");
fprintf(out,"%d/n",n);
for(i=0;i<n;i++);
fprintf(out,"%4d/n",h[i].s);
fclose(out);

我来回答:

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

订单号:

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