等级考试上机题目(上课用)
时间:2026-01-17
时间:2026-01-17
第1套
1.程序填空:
#include <stdio.h>
#include <stdlib.h>
#define N 5
typedef struct
{int num;
char name[10];
char tel[10];
}STYPE;
void check();
/**********found**********/
int fun(___1___ *std)
{
/**********found**********/
___2___ *fp; int i;
if((fp=fopen("myfile5.dat","wb"))==NULL)
return(0);
printf("\nOutput data to file !\n");
for(i=0; i<N; i++)
/**********found**********/
fwrite(&std[i], sizeof(STYPE), 1, ___3___);
fclose(fp);
return (1);
}
main()
{STYPE s[10]={ {1,"aaaaa","111111"},{1,"bbbbb",
"222222"},{1,"ccccc","333333"},{1,"ddddd","444444"},{1,"eeeee", "555555"}};
int k;
k=fun(s);
if (k==1)
{printf("Succeed!"); check();}
else
printf("Fail!");
}
void check()
1
下一篇:LED电子屏招标公告