for(i=1;i for(i=3;i a[i][j]=a[i-1][j-1]+a[i-1][j]; for(i=1;i {int a[16][16],i,j,k,p,m,n; p=1; while(p==1) {scanf(\ if((n!=0)&&(n<=15)&&(n%2!=0))p=0; } for(i=1;i<=n;i++) for(j=1;j<=n;j++) a[i][j]=0; j=n/2+1; a[1][j]=1; for(k=2;k<=n*n;k++) {i=i-1; j=j+1; if((i<1)&&(j>n)) {i=i+2; j=j-1; } else {if(i<1)i=n; if(j>n)j=1; } if(a[i][j]==0)a[i][j]=k; else {i=i+2; j=j-1; a[i][j]=k; } 16 } for(i=1;i<=n;i++) {for(j=1;j<=n;j++) printf(\ printf(\ } } 6.8 #define N 10 #define M 10 main() {int i,j,k,m,n,flag1,flag2,a[N][M],max,maxi,maxj; scanf(\ for(i=0;i for(i=0;i if(flag1) { printf(\ flag2=1; } } if(!flag2) printf(\} 6.9 #i nclude {int i,j,number,top,bott,min,loca,a[N],flag; char c; for(i=0;i<=N;i++) scanf(\ flag=1; 17 while(flag) {scanf(\ loca=0; top=0; bott=N-1; if((numbera[N-1])) loca=-1; while((loca==0)&&(top<=bott)) {min=(bott+top)/2; if(number==a[min]) {loca=min; printf(\ } else if(number top=min+1; } if(loca==0||loca==-1) printf(\ printf(\ c=getchar(); if(c=='N'||c=='n')flag=0; } } 6.10 main() {int i,j,uppn,lown,dign,span,othn; char text[3][80]; uppn=lown=dign=span=othn=0; for(i=0;i<3;i++) {gets(text[i]); for(j=0;j<80&&text[i][j]!='\\0';j++) {if(text[i][j]>='A'&&text[i][j]<='Z') uppn++; else if(text[i][j]>='a'&&text[i][j]<='z') lown++; else if(text[i][j]>='0'&&text[i][j]<='9') dign++; else if(text[i][j]==' ') span++; else othn++; 18 } } for(i=0;i<3;i++) printf(\ printf(\ printf(\ printf(\ printf(\ printf(\} 6.11 main() {static char a[5]={'*','*','*','*','*'}; int i,j,k; char space=' '; for(i=0;i<=5;i++) {printf(\ for(j=1;j<=3*i;j++) printf(\ for(k=0;k<=5;k++) printf(\ } } 6.12 #i nclude char ch[80],tran[80]; gets(ch); i=0; while(ch[i]!='\\0') {if((ch[i]>='A')&&(ch[i]<='Z')) tran[i]=26+64-ch[i]+1+64; else if((ch[i]>='a')&&(ch[i]<='z')) tran[i]=26+96-ch[i]+1+96; else tran[i]=ch[i]; i++; } n=i; for(i=0;i 19 } 6.13 main() {char s1[80],s2[40]; int i=0,j=0; scanf(\ scanf(\ while(s1[i]!='\\0')i++; while(s2[j]!='\\0')s1[i++]=s2[j++]; s1[i]='\\0'; printf(\} 6.14 #i nclude char s1[100],s2[100]; gets(s1); gets(s2); i=0; while((s1[i]==s2[i])&&(s1[i]!='\\0'))i++; if(s1[i]=='\\0'&&s2[i]=='\\0')resu=0; else resu=s1[i]-s2[i]; printf(\} 6.15 #i nclude\main() {char from[80],to[80];; int i; scanf(\ for(i=0;i<=strlen(from);i++) to[i]=from[i]; printf(\} 第七章 7.1 hcf(u,v) int u,v; 20
c答案(4)
2019-03-29 09:43
c答案(4).doc
将本文的Word文档下载到电脑
下载失败或者文档不完整,请联系客服人员解决!