二级C语言上机题答案(题库答案)

申明敬告: 本站不保证该用户上传的文档完整性,不预览、不比对内容而直接下载产生的反悔问题本站不予受理。

文档介绍

二级C语言上机题答案(题库答案)

第一套填空题1.while(p!=NULL)2.if(p->data==ch)returnn;3.k=fun(head,ch);改错1.{intj,c=0;floatxa=0.0;2.if(x[j]>=xa)编程inti=0,j=0;while(a+inext;3.fun(head,&num);改错1.for(i=j+1;i=eps){sum+=t;i++;t=t*i/(2*i+1);}return2*sum;第三套填空1.s+=p->data;2.p=p->next;3.printf("nsum=%dn",fun(head));改错1.sum=0.0;2.if((i+1)%5==0)编程inti=0,j=0;while(s[i]!='')i++;while(t[j]!='')j++;if(i>=j)returns;elsereturnt;第四套填空1.STUfun(STU*std,char*num)2.if(strcmp(std[i].num,num)==0)3.return(std[i]);改错1.if(*r==*p){r++;p++;}2.if(*r=='')编程inti=0,j=0;while(a[i]=='*')i++;if(i>n)for(j=0,i=i-n;a[i];i++)a[j++]=a[i];a[j]=0;第五套填空1.if(std[i].year==year)2.k[n++]=std[i];3.return(n);改错1.aa[i]=m%k;2.for(i=i-1;i>=0;i--)编程inti;floatave=0;for(i=0;iscore[i]*=a;3.modify(&std,a);改错1.for(i=strlen(t)-1;i>=0;i--)2.if(t[j]>t[j+1])编程inti;doubleaver=0;for(i=0;i=ave)b[j++]=a[i];*n=j;returnave;第八套填空1.max=std[0];2.if(max.agen[j])k=j;3.strcpy(ss[k],t);改错1.voidfun(char*a)2.printf("%c",*a);编程*c=b%10*1000+a/10*100+b/10*10+a%10;第十套填空1.n=len;k=i;2.for(j=len;j>=0;j--)3.ss[i][j]='*';改错1.value=FU((a+b),(a-b))+FU((c+b),(c-b));2.return(value);编程STRECc={"",-1};inti;for(i=0;idata=x;2.q=p;3.q->next=s;改错1.intfun(inta[],intm)2.elseif(m>a[mid])编程inti,j=0;for(i=0;i=l&&a[i].s<=h)b[j++]=a[i];returnj;第十二套填空1.nif((fs=fopen(source,"r"))==NULL)2.while(!feof(fs))3.fputc(ch,ft);改错1.switch(g)2.case1:case2:return1;编程STREC*p;doubleave=0;p=h->next;while(p!=NULL){ave+=p->s/N;p=p->next;}returnave;第十三套填空1.fprintf(fp,"%d%fn",i,sqrt((double)i));2.fclose(fp);3.if((fp=fopen(fname,"r"))==NULL)改错1.for(i=0;str[i];i++)2.if(substr[k+1]=='')编程unsignedn=w;inti=1;while(n>10){i*=10;n/=10;}returnw%i;第十四套填空1.voidWriteText(FILE*fw)2.fputs(str,fw);fputs(""n"",fw);3.printf(""%s"",str);改错1.s[j++]=s[i];2.s[j]='';编程inti,max=s[0];*k=0;for(i=1;imax){max=s[i];*k=i;}第十五套填空1.intfun(STYPE*std)2.FILE*fp;inti;3.fwrite(&std[i],sizeof(STYPE),1,fp);改错1.doublek;2.if(*s>*p)编程longt=0;inti=0,flag=1;if(p[i]=='+'){flag=1;i++;}if(p[i]=='-'){flag=-1;i++;}for(;p[i];i++){t=t*10+p[i]-'0';}return(t*flag);第十六套填空1.t=t->next;2.printf(""%d"",t->data);3.free(t);改错1.if(('a'<=tt[i])&&(tt[i]<='z'))2.tt[i]-=32;编程inti;*n=0;for(i=7;i<=m;i++)if(i%7==0||i%11==0)a[(*n)++]=i;第十七套填空1.free(q);2.q=p->next;3.q=q->next;改错1.voidfun(char*s,int*a,int*b)2.*a=1+*a;3.(*b)++;编程inti;*max=a[0];*d=0;for(i=1;i='a')&&(ch<='z'))2.returnch+'a'-'A';3.returnch;改错1.doublefun(n)2.returnsum;编程inti;doublesum=0;for(i=0;i<8;i++)sum+=sqrt((x[i]+x[i+1])/2);returnsum;第二十套填空1.for(i=0;i=1e-6;i++){t=t*(0.5-i+1)*x/i;sum+=t;}returnsum;第二十三套填空1.for(i=0;i0)编程inti,j;doublesum=0;for(i=3;isqrt(i))sum+=sqrt(i);}returnsum;第二十五套填空1.if(s[i]>='0'&&s[i]<='9')2.while(s[i+1+n]!=0)n++;3.s[j+1]=s[j];改错1.intfun(intn,intxx[][M])2.printf(""%4d"",xx[i][j]);编程inti;doublesum=1,j=0;for(i=1;i<=n;i++){j+=sqrt(i);sum+=j;}returnsum;第二十六套填空1.for(i=0;s[i]!=(int)NULL;i++)2.if(s[i]>='0'&&s[i]<='9')n++;3.*t=n;改错1.*t=0;2.if(d%2!=0)编程inti,j=strlen(s)-1;charmid;for(i=0;i=i/2)aa[t++]=i;}returnt;第二十九套填空1.for(i=0;s[i]!=0;i++)2.n=0;3.s[j+1]=c;改错1.while(*w)2.if(*r==*p)编程inti,j;intsum=0;for(i=0;itt[i][j])pp[j]=tt[i][j];}第三十二套填空1.fp=fopen(filename,""rb+"");2.fseek(fp,m,SEEK_END);3.fwrite(&n,sizeof(STU),1,fp);改错1.sum=0;j=0;2.if(sum%4==2)编程inti,j=strlen(a[0]);*max=a[0];for(i=1;i=0&&k<=6)编程inti,j;doubleave=0;for(i=0;i=0;j--)3.t[j][N-1]=r[j];改错1.for(i=1;i<=y;i++)2.t=t%1000;编程inti=0,j=0;for(;p1[i];i++);for(j=0;p2[j];j++)p1[i+j]=p2[j];p1[i+j]=0;第三十七套填空1.voidfun(int(*t)[N])2.t[i][j]=t[i][j]+t[j][i];3.t[j][i]=0;改错1.y=1;2.d=a-i;编程inti,j;for(i=0;i<3;i++)for(j=0;j<3;j++)b[i][j]=a[i][j]+a[j][i];第三十八套填空1.sum=0;2.sum+=t[i][i];3.sum+=t[i][n-i-1];改错1.return3;2.elsereturn1;编程inti,j=0;doubleave;for(i=0;ia[j])改错1.Isprime(n)2.if(!(n%i))编程inti,j,t=0;for(i=m+1;ti/2)xx[t++]=i;}第四十二套填空1.voidfun(int*a,intn)2.for(i=0;i0)2.*(pstr+i)=*(pstr+j);编程inti;*s=a[0];for(i=1;ia[i].s)*s=a[i];第四十四套填空1.for(i=0;i='0'&&ch<='9')3.return'9'-(ch-'0');改错1.voidfun(int*a,int*b)2.t=*b;*b=*a;*a=t;编程inti,j=0;for(i=0;s[i];i++)if(!(i%2==0&&s[i]%2))t[j++]=s[i];t[j]=0;第四十六套填空n1.for(j=2;j=i)改错1.{if((k%13==0)||(k%17==0))2.}编程inti;floatp=1;for(i=1;i<=m;i++)p=p*i;for(i=1;i<=n;i++)p=p/i;for(i=1;i<=m-n;i++)p=p/i;returnp;第四十七套填空1.for(j=a[i]*2;j<=n;j+=a[i])2.while(a[i]==0)3.if(a[i]!=0)改错1.for(i=0;i=1e-6){x0=x1;x1=cos(x0);}returnx1;第四十八套填空1.#defineOK(i,t,n)((i%t==0)&&(i/t=i)编程inti,j=0;for(i=0;s[i];i++)if(s[i]%2)t[j++]=s[i];t[j]=0;第四十九套填空1.t=(a>b)?(b>c?b:(a>c?c:a)):((a>c)?a:((b>c)?c:b));改错1.p=j;2.p=i;编程inti;doubles=0;for(i=21;i0.001)编程inti,j=0;for(i=0;s[i];i++)if(s[i]%2==0)t[j++]=s[i];t[j]=0;第五十一套填空1.fp=fopen(filename,""rb"");2.if(s[i].sno>s[j].sno)3.fwrite(s,sizeof(STU),N,fp);改错1.for(i=2;i<=m;i++)2.y-=1.0/(i*i);编程intf0=0,f1=1,f=f0+f1;while(f1<=s){f0=f1;f1=f;f=f0+f1;}returnf1;第五十二套填空1.n=0;2.while(t<=x)3.t++;改错1.num[k]=0;2.switch(*s)编程inti,j=0;for(i=0;s[i];i++)if(i%2&&s[i]%2)t[j++]=s[i];t[j]=0;第五十三套填空1.while(t<=999){2.s1=t%10;s2=(t/10)%10;s3=t/100;3.if(s1+s2+s3==x)改错1.q=p+i;2.while(q>p)编程inti;doubles=0;for(i=1;i<=m;i++)s+=log(double(i));returnsqrt(s);第五十四套填空1.t[j]=*(s+i);j++;}2.for(i=0;iav)y[j++]=x[i];改错1.while(i<4&&*p)2.b[k++]='';编程inti=0,j=0;while(a[i]=='*')i++;while(a[i]){a[j++]=a[i];i++;}a[j]=0;第五十六套填空1.d=d*10+*s-'0';2.s++;}3.returnctod(a)+ctod(b);改错1.if(d%2==0)2.s/=10;编程return(int)(h*100+0.5)/100.0;第五十七套填空1.n++;flag=1;}2.if(*s=='')flag=0;3.s++;改错1.j=1;2.m=j%y;3.m=j%y;编程inti,j=0;*n=0;nfor(i=1;i<=x;i+=2)if(x%i==0)pp[(*n)++]=i;第五十八套填空1.k=i;2.if(strlen(ps[k])='a'&&ss[i]<='z')ss[i]-=32;第六十一套填空1.while(!feof(fp))2.if(n.sno==sno)break;3.fseek(fp,-1L*(long)sizeof(STU),SEEK_CUR);改错1.if(k>0)2.elseif(k==0)编程inti;doubles=0;for(i=1;i<=n;i++){s+=1.0/(i*(i+1));}returns;第六十二套填空1.{t=*n%10;2.if(t%2!=0)3.*n=x;改错1.fun(inta[][M],intm)2.a[j][k]=(k+1)*(j+1);编程inti;doubles=1,t=1;for(i=1;i<=n;i++){t=t*x/i;s+=t;}returns;第六十三套填空1.*av=s/N;2.d=*av-x[i];j=i;}3.returnx[j];改错1.while((high>=2)&&(n<10))2.{yes=0;break;}编程inti=strlen(a)-1;while(a[i]=='*')i--;a[i+1]=0;第六十四套填空1.b[i]=a[0][i];2.if(b[i]=num)2.t=s*1/n;编程inti=0,j=0;while(a[i]=='*'){i++;j++;}while(a[i]){if(a[i]!='*')a[j++]=a[i];i++;}a[j]=0;第六十五套填空1.voidfun(int(*a)[N])2.for(j=i;j
查看更多

相关文章