二级C语言50题库(简洁背诵复习版)1.docVIP

  • 19
  • 0
  • 约3.35万字
  • 约 71页
  • 2016-12-14 发布于重庆
  • 举报
第1套题 一、程序填空题 #include stdio.h #include stdlib.h #define N 5 typedef struct { int num;Char name [10];char tell[10]; }STYPE; void check(); /**********found**********/ int fun(STYPE STYPE *std) { /**********found**********/FILE *fp;int i;if((fp=fopen(myfile5.dat,wb))==NULL)return(0);printf(\nOutput data to file !\n);for(i=0; iN; i++) /**********found**********/fwrite(std[i], sizeof(STYPE), 1,fp);fclose(fp);return (1); }二、程序改错题 #include stdio.h #include string.h void fun (char *s, char *t) { int i, sl;sl = strlen(s); /************found************/for( i=0; i=sl; i ++)t[i] = s[i];for (i=0; isl; i++) t[sl+i] = s[sl-i-1]; /************found************/t[sl+sl] = \0; } 三、程序编写题 (对应题库88套编程题--特殊方法练习) 第2套题 一、程序填空题 /**********found**********/ void WriteText(FILE *fw) { char str[81];printf(\nEnter string with -1 to end :\n);gets(str);while(strcmp(str,-1)!=0) { /**********found**********/fputs(str,fw); fputs(\n,fw);gets(str);} } void ReadText(FILE *fr) { char str[81];printf(\nRead file and output to screen :\n);fgets(str,81,fr);while( !feof(fr) ) { /**********found**********/printf(%s,str);fgets(str,81,fr);} } 二、程序改错题 #include stdio.h /************found************/ void fun (long s, long t) { long sl=10;*t = s % 10;while ( s 0){ s = s/100;*t = s%10 * sl + *t; /************found************/ S1=s1*10;} } 三、程序编写题 (对应教材33题—特殊方法练习) 第3套题 一、程序填空题 #include math.h #include stdio.h int fun(char *fname ) { FILE *fp;int i,n;float x;if((fp=fopen(fname, w))==NULL) return 0;for(i=1;i=10;i++) /**********found**********/fprintf(___1___,%d %f\n,i,sqrt((double)i));printf(\nSucceed!!\n); /**********found**********/___2___;printf(\nThe data in file :\n); /**********found**********/if((fp=fopen(___3___,r))==NULL)return 0;fscanf(fp,%d%f,n,x);while(!feof(fp)){ printf(%d %f\n,n,x); fscanf(fp,%d%f,n,x); }fclose(fp);return 1; } 二、程序改错题 #include stdio.h #include stdlib.h void fun ( int n, int *a ) { int i, j, p, t;for

文档评论(0)

1亿VIP精品文档

相关文档