资源预览内容
第1页 / 共71页
第2页 / 共71页
第3页 / 共71页
第4页 / 共71页
第5页 / 共71页
第6页 / 共71页
第7页 / 共71页
第8页 / 共71页
第9页 / 共71页
第10页 / 共71页
亲,该文档总共71页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
第第 1 套题套题一、程序填空题#include #include #define N 5 typedef struct int num;Char name 10;char tell10; 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; i #include void fun (char *s, char *t) int i, sl;sl = strlen(s); /*found*/for( i=0; i/*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 套题套题一、程序填空题参考答案:参考答案: (1) void fun(long s,long *t) (2) s1=s1*10;#include #include int fun(char *fname ) FILE *fp; int i,n; float x;if(fp=fopen(fname, “w“)=NULL) return 0;for(i=1;i #include void fun ( int n, int *a ) int i, j, p, t;for ( j = 0; jai )参考答案参考答案 (1)fp (2)fclose(fp) (3)myfile3.txt参考答案参考答案 (1)for(i=j+1;i #include int fun(char *source, char *target) FILE *fs,*ft; char ch; /*found*/if(fs=fopen(source, _1_)=NULL)return 0;if(ft=fopen(target, “w“)=NULL)return 0;printf(“nThe data in file :n“);ch=fgetc(fs); /*found*/while(!feof(_2_) putchar( ch ); /*found*/fputc(ch,_3_);ch=fgetc(fs);参考答案:参考答案: (1)“r“ (2)fs (3)ftfclose(fs); fclose(ft);printf(“nn“);return 1; 二、程序改错题#include void fun (long s, long *t) int d;long sl=1;*t = 0;while ( s 0) d = s%10; /*found*/if (d%2=0) *t=d* sl+ *t;sl *= 10; /*found*/s = 10; 三、程序编写题 (对应题库对应题库 75 套编程题套编程题特殊方法练习特殊方法练习)第第 5 套题套题一、程序填空题参考答案:参考答案: (1)if (d%2=0) (2) s/=10;#include #include #define N 8 typedef struct list int data;struct list *next; SLIST; void fun( SLIST *h, int x) SLIST *p, *q, *s;s=(SLIST *)malloc(sizeof(SLIST); /*found*/s-data=_1_;q=h;p=h-next;while(p!=NULL p=p-next;s-next=p; /*found*/q-next=_3_; 二、程序改错题#include long fun (long num) /*found*/long k;do k*=num%10 ;参考答案:参考答案: (1)x (2)p (3)s参考答案:参考答案: (1)long k=1; (2)num/=10;/*found*/num=10 ; while(num) ;return (k) ; 三、程序编写题 (对应题库对应题库 87 套编程题套编程题特殊方法练习特殊方法练习)第第 6 套题套题一、程序填空题#include #include #define N 8 typedef struct list int data;struct list *next; SLIST;void fun( SLIST *p) SLIST *t, *s;t=p-next; s=p;while(t-next != NULL) s=t; /*found*/t=t-_1_; /*found*/printf(“ %d “,_2_);s-next=NULL; /*found*/参考答案:参考答案: (1) next (2) t-data (3) tfree(_3_); 二、程序改错题#include /*found*/ fun (char a) if ( *a ) fun(a+1) ; /*found*/printf(“%c“ *a) ; 三、程序编写题 (对应题库对应题库 56 套编程题套编程题特殊方法练习特殊方法练习)第第 7 套题套题一、程序填空题void fun( SLIST *h) SLIST *p, *q;p=h-next;if (p!=NULL) q=p-next;while(q!=NULL) if (p-data=q-data)参考答案:参考答案: (1) void fun(char *a) (2) print(“%c“,*a); p-next=q-next; /*found*/free(_1_); /*found*/q=p-_2_;else p=q; /*found*/q=q-_3_; 二、程序改错题void fun(int a, int n) int i, j, t, p;for (j = 0 ;j next; /*found*/while(p!=_1_) n+; /*found*/if (p-data=ch) return _2_;else p=p-next;return 0; main() SLIST *head; int k; char ch;char aN=m,p,g,a,w,x,r,d;head=creatlist(a);outlist(head);printf(“Enter a letter:“);scanf(“%c“, /*found*/k=fun(_3_);if (k=0) printf(“nNot found!n“);参考答案:参考答案: (1)0 或或 NULL (2)n (3)head,chelse printf(“The sequence number is : %dn“,k); 二、程序改错题#include #include #include fun ( char *p) int i,t; char c80; /*found*/For (i = 0,t = 0; pi ; i+)if(!isspace(*(p+i) ct+=pi; /*found*/ct=“0“;strcpy(p,c); 三、程序编写题 (对应题库对应题库 86 套编程题套编程题特殊方法练习特殊方法练习)第第 9 套题套题一、程序填空题void fun( SLIST *h, int *n) SLIST *p; /*found*/_1_=0;p=h-next;while(p) (*n)+;参考答案:参考答案: (1) for(i=0,t=0;pi;i+) (2) ct=0;参考答案:参考答案: (1) *n (2) next (3) head/*found*/p=p-_2_; main() SLIST *head;int aN=12,87,45,32,91,16,20,48, num;head=creatlist(a); outlist(head); /*found*/fun(_3_, printf(“nnumber=%dn“,num); 二、程序改错题char * fun (char *s, char *t ) char *p , *r, *a; /*found*/a = Null;while ( *s ) p = s; r = t;while ( *r ) /*found*/if ( r = p ) r+; p+; else break;if ( *r = 0 ) a = s;s+;return a ; 三、程序编写题 (对应题库对应题库 94 套编程题套编程题特殊方法练习特殊方法练习)参考答案:参考答案: (1) a=NULL; (2) if(*r=*p)第第 10 套题套题一、程序填空题int fun( SLIST *h) SLIST *p; int s=
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号