1 / 153
文档名称:

二级C语言题库word文档.doc

格式:doc   页数:153
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

二级C语言题库word文档.doc

上传人:精品文档 2015/12/30 文件大小:0 KB

下载得到文件列表

二级C语言题库word文档.doc

文档介绍

文档介绍:第1套题
一、程序填空题
#include <>
#include <>
#define N 5
typedef struct
{ int num;
char name[10];
char tel[10];
}STYPE;
void check();
/**********found**********/
int fun(___STYPE ___ *std)
{
/**********found**********/
___FILE___ *fp; int i;
if((fp=fopen("","wb"))==NULL)
return(0);
printf("\nOutput data to file !\n");
for(i=0; i<N; i++)
/**********found**********/
fwrite(&std[i], sizeof(STYPE), 1, ___fp___);
fclose(fp);
return (1);
}
main()
{ STYPE s[10]={ {1,"aaaaa","111111"},{1,"bbbbb","222222"},{1,"","333333"},
{1,"ddddd","444444"},{1,"eeeee","555555"}};
int k;
k=fun(s);
if (k==1)
{ printf("eed!"); check(); }
else
printf("Fail!");
}
void check()
{ FILE *fp; int i;
STYPE s[10];
if((fp=fopen("","rb"))==NULL)
{ printf("Fail !!\n"); exit(0); }
printf("\nRead file and output to screen :\n");
printf("\n num name tel\n");
for(i=0; i<N; i++)
{ fread(&s[i],sizeof(STYPE),1, fp);
printf("%6d %s %s\n",s[i].num,s[i].name,s[i].tel);
}
fclose(fp);
}
二、程序改错题
#include <>
#include <>
void fun (char *s, char *t)
{ int i, sl;
sl = strlen(s);
/************found************/
for( i=0; i<=s1; i ++)
t[i] = s[i];
for (i=0; i<sl; i++)
t[sl+i] = s[sl-i-1];
/************found************/
t[2*sl] = '\0';
}
main()
{ char s[100], t[100];
printf("\nPlease enter string s:"); scanf("%s", s);
fun(s, t);
printf("The result is: %s\n", t);
}
三、程序编写题
#include <>
void fun(int a, int b, long *c)
{*c=(a/10)*1000+(b/10)*100+(a%10)*10+(b%10);
}
main()
{ int a,b; long c;
void NONO ( );
printf("Input a b:"); scanf("%d%d", &a, &b);
fun(a, b, &c);
printf("The result is: %d\n", c);
NONO();
}
void NONO ( )
{/* 本函数用于打开文件,输入数据,调用函数,输出数据,关闭文件。*/
FILE *rf, *wf ;
int i, a,b ; long c ;
rf = fopen("K:\\k01\\24010001\\", "r") ;
wf = fopen("K:\\k01\\24010001\\","w") ;
for(i = 0 ; i < 10 ; i++) {
fscanf(rf, "%d,%d", &a, &b) ;

最近更新

2024年湖南电子科技职业学院单招职业技能考试.. 39页

2024年湖南省张家界市单招职业适应性测试模拟.. 41页

2024年湖南省永州市单招职业倾向性考试题库新.. 40页

2024年湖南省郴州市单招职业倾向性考试题库及.. 39页

2024年湖南石油化工职业技术学院单招职业适应.. 40页

2024年湖南网络工程职业学院单招职业技能测试.. 40页

2024年湖南财经工业职业技术学院单招职业倾向.. 40页

2024年湖南都市职业学院单招职业技能考试题库.. 41页

2024年湖南高尔夫旅游职业学院单招职业倾向性.. 38页

2024年湖州学院单招职业倾向性测试题库及答案.. 40页

2024年湖州职业技术学院单招职业适应性考试模.. 42页

2024年湘南幼儿师范高等专科学校单招职业技能.. 40页

2024年滁州城市职业学院单招职业倾向性测试模.. 39页

2024年漳州科技学院单招职业技能测试题库及答.. 40页

2024年漳州职业技术学院单招职业倾向性考试模.. 42页

2024年潍坊工程职业学院单招职业适应性测试题.. 39页

2024年潍坊环境工程职业学院单招职业技能测试.. 41页

2024年潍坊食品科技职业学院单招职业倾向性考.. 40页

2024年潞安职业技术学院单招职业适应性考试题.. 40页

2024年炎黄职业技术学院单招职业倾向性测试题.. 40页

2024年烟台南山学院单招职业适应性考试模拟测.. 40页

2024年烟台科技学院单招职业倾向性测试模拟测.. 40页

2024年烟台黄金职业学院单招职业适应性考试模.. 39页

2024年焦作工贸职业学院单招职业适应性测试模.. 39页

2024年焦作新材料职业学院单招职业技能测试题.. 40页

2024年牡丹江大学单招职业倾向性测试模拟测试.. 40页

2024年琼台师范学院单招职业技能测试题库必考.. 41页

2024年甘肃交通职业技术学院单招职业倾向性考.. 41页

2025年医院感染管理质量控制评价内容及考核标.. 2页

2024年常州机电职业技术学院单招职业适应性测.. 78页