资源描述:
《南昌大学C语言考试题库.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、一、阅读程序写出程序运行结果阅读以下程序并写出其运行结果#include#includeintfun(chars[],intc){char*q=s;for(;*q;q++)if(*q!=c)*(s++)=*q;*s=0;}main(){staticcharstr[]="turbocandborlandc++";charch;fun(str,'c');printf("str[]=%s",str);system("pause");}程序的运行结果是str[]=turbo
2、andBorland++阅读以下程序并写出其运行结果#include#includevoidfun(inta,intb,long*c){*c=a/10*10+a%10*1000+b/10*100+b%10;}main(){inta=42,b=25;longc;fun(a,b,&c);printf("Theresultis:%ld",c);system("pause");}程序的运行结果是theresultis:2245请按任意键继续…阅读以下程序并写出其运行结果#i
3、ncludevoidfun(int*s,intnl,intn2){inti,j,t;i=nl;j=n2;while(i4、e阅读以下程序并写出其运行结果#includemain(){inti=1;while(!((i%2==1)&&(i%3==2)&&(i%5==4)&&(i%6==5)&&(i%7==0)))++i;printf(">>Theladderhas%dstages.",i);}程序的运行结果是阅读以下程序并写出其运行结果#include#defineROW3#defineCOL4main(){intmatrixA[ROW][COL]={11,12,13,14,15,16
5、,17,18,19,20,21,22};intmatrixB[COL][ROW];inti,j;printf("%d*%d:",ROW,COL);for(i=0;i6、printf("");}system("pause");}程序的运行结果是3*4MatrixB4*3111519121620131721141822阅读以下程序并写出其运行结果#include#defineN10main(){intprimes[N];intpc,m,k;printf("Thefirst%dprimenumbersare:",N);primes[0]=2;pc=1;m=3;while(pc7、if(m%primes[k]==0){m+=2;k=1;}elsek++;primes[pc++]=m;m+=2;}for(k=0;k#includevoidfun(char*s[],intn){char*t;inti,j;for(
8、i=0;istrlen(s[j])){t=s[i];s[i]=s[j];s[j]=t;}}main(){char*ss[]={“bcc”,”bbcc”,”xy”,”aaaacc”,”aabcc”};fun(ss,5);printf(“%s,%s”,ss[0],ss[4]);}程序的运行结果是阅读以下程序并写出其运行结果#in
|