九九热最新网址,777奇米四色米奇影院在线播放,国产精品18久久久久久久久久,中文有码视频,亚洲一区在线免费观看,国产91精品在线,婷婷丁香六月天

《C語言程序設(shè)計》課后習題答案第四版譚浩強.docx

上傳人:小** 文檔編號:16805421 上傳時間:2020-10-26 格式:DOCX 頁數(shù):112 大?。?5.88KB
收藏 版權(quán)申訴 舉報 下載
《C語言程序設(shè)計》課后習題答案第四版譚浩強.docx_第1頁
第1頁 / 共112頁
《C語言程序設(shè)計》課后習題答案第四版譚浩強.docx_第2頁
第2頁 / 共112頁
《C語言程序設(shè)計》課后習題答案第四版譚浩強.docx_第3頁
第3頁 / 共112頁

下載文檔到電腦,查找使用更方便

5 積分

下載資源

還剩頁未讀,繼續(xù)閱讀

資源描述:

《《C語言程序設(shè)計》課后習題答案第四版譚浩強.docx》由會員分享,可在線閱讀,更多相關(guān)《《C語言程序設(shè)計》課后習題答案第四版譚浩強.docx(112頁珍藏版)》請在裝配圖網(wǎng)上搜索。

1、第1章程序設(shè)計和C語言11.1什么是計算機程序11.2什么是計算機語言11.3C語言的發(fā)展及其特點31.4最簡單的C語言程序51.4.1最簡單的C語言程序舉例61.4.2C語言程序的結(jié)構(gòu)101.5運行C程序的步驟與方法121.6程序設(shè)計的任務(wù)141-5 #include int main ( ) printf (*nn); printf( Very Good!nn); printf (*n); return 0;1-6#include int main()int a,b,c,max; printf(please input a,b,c:n); scanf(%d,%d,%d,&a,&b,&c);

2、 max=a; if (maxb) max=b; if (maxc) max=c; printf(The largest number is %dn,max); return 0;第2章算法程序的靈魂162.1什么是算法162.2簡單的算法舉例172.3算法的特性212.4怎樣表示一個算法222.4.1用自然語言表示算法222.4.2用流程圖表示算法222.4.3三種基本結(jié)構(gòu)和改進的流程圖262.4.4用NS流程圖表示算法282.4.5用偽代碼表示算法312.4.6用計算機語言表示算法322.5結(jié)構(gòu)化程序設(shè)計方法34習題36第章最簡單的C程序設(shè)計順序程序設(shè)計373.1順序程序設(shè)計舉例373.2

3、數(shù)據(jù)的表現(xiàn)形式及其運算393.2.1常量和變量393.2.2數(shù)據(jù)類型423.2.3整型數(shù)據(jù)443.2.4字符型數(shù)據(jù)473.2.5浮點型數(shù)據(jù)493.2.6怎樣確定常量的類型513.2.7運算符和表達式523.3C語句573.3.1C語句的作用和分類573.3.2最基本的語句賦值語句593.4數(shù)據(jù)的輸入輸出653.4.1輸入輸出舉例653.4.2有關(guān)數(shù)據(jù)輸入輸出的概念673.4.3用printf函數(shù)輸出數(shù)據(jù)683.4.4用scanf函數(shù)輸入數(shù)據(jù)753.4.5字符數(shù)據(jù)的輸入輸出78習題823-1 #include #include int main()float p,r,n; r=0.1; n=10

4、; p=pow(1+r,n); printf(p=%fn,p); return 0;3-2-1#include #include int main()float r5,r3,r2,r1,r0,p,p1,p2,p3,p4,p5; p=1000; r5=0.0585; r3=0.054; r2=0.0468; r1=0.0414; r0=0.0072; p1=p*(1+r5)*5); / 一次存5年期 p2=p*(1+2*r2)*(1+3*r3); / 先存2年期,到期后將本息再存3年期 p3=p*(1+3*r3)*(1+2*r2); / 先存3年期,到期后將本息再存2年期 p4=p*pow(1+

5、r1,5); / 存1年期,到期后將本息存再存1年期,連續(xù)存5次 p5=p*pow(1+r0/4,4*5); / 存活期存款?;钇诶⒚恳患径冉Y(jié)算一次 printf(p1=%fn,p1); / 輸出按第1方案得到的本息和 printf(p2=%fn,p2); / 輸出按第2方案得到的本息和 printf(p3=%fn,p3); / 輸出按第3方案得到的本息和 printf(p4=%fn,p4); / 輸出按第4方案得到的本息和 printf(p5=%fn,p5); / 輸出按第5方案得到的本息和 return 0;3-2-2#include #include int main()double

6、r5,r3,r2,r1,r0,p,p1,p2,p3,p4,p5; p=1000; r5=0.0585; r3=0.054; r2=0.0468; r1=0.0414; r0=0.0072; p1=p*(1+r5)*5); / 一次存5年期 p2=p*(1+2*r2)*(1+3*r3); / 先存2年期,到期后將本息再存3年期 p3=p*(1+3*r3)*(1+2*r2); / 先存3年期,到期后將本息再存2年期 p4=p*pow(1+r1,5); / 存1年期,到期后將本息存再存1年期,連續(xù)存5次 p5=p*pow(1+r0/4,4*5); / 存活期存款。活期利息每一季度結(jié)算一次 print

7、f(p1=%fn,p1); / 輸出按第1方案得到的本息和 printf(p2=%fn,p2); / 輸出按第2方案得到的本息和 printf(p3=%fn,p3); / 輸出按第3方案得到的本息和 printf(p4=%fn,p4); / 輸出按第4方案得到的本息和 printf(p5=%fn,p5); / 輸出按第5方案得到的本息和 return 0;3-2-3#include #include int main()float r5,r3,r2,r1,r0,p,p1,p2,p3,p4,p5; p=1000; r5=0.0585; r3=0.054; r2=0.0468; r1=0.0414

8、; r0=0.0072; p1=p*(1+r5)*5); / 一次存5年期 p2=p*(1+2*r2)*(1+3*r3); / 先存2年期,到期后將本息再存3年期 p3=p*(1+3*r3)*(1+2*r2); / 先存3年期,到期后將本息再存2年期 p4=p*pow(1+r1,5); / 存1年期,到期后將本息存再存1年期,連續(xù)存5次 p5=p*pow(1+r0/4,4*5); / 存活期存款?;钇诶⒚恳患径冉Y(jié)算一次 printf(p1=%10.2fn,p1); / 輸出按第1方案得到的本息和 printf(p2=%10.2fn,p2); / 輸出按第2方案得到的本息和 printf(p3

9、=%10.2fn,p3); / 輸出按第3方案得到的本息和 printf(p4=%10.2fn,p4); / 輸出按第4方案得到的本息和 printf(p5=%10.2fn,p5); / 輸出按第5方案得到的本息和 return 0;3-3.#include #include int main()float d=300000,p=6000,r=0.01,m; m=log10(p/(p-d*r)/log10(1+r); printf(m=%6.2fn,m); return 0;3-4#include int main()int c1,c2; c1=197; c2=198; printf(c1=%

10、c,c2=%cn,c1,c2); printf(c1=%d,c2=%dn,c1,c2); return 0;3-5#include int main()int a,b; float x,y; char c1,c2; scanf(a=%d b=%d,&a,&b); scanf(%f %e,&x,&y); scanf(%c%c,&c1,&c2); printf(a=%d,b=%d,x=%f,y=%f,c1=%c,c2=%cn,a,b,x,y,c1,c2); return 0;3-6#include int main()char c1=C,c2=h,c3=i,c4=n,c5=a; c1=c1+4;

11、c2=c2+4; c3=c3+4; c4=c4+4; c5=c5+4; printf(passwor is %c%c%c%c%cn,c1,c2,c3,c4,c5); return 0;3-7#include int main ()float h,r,l,s,sq,vq,vz; float pi=3.141526; printf(請輸入圓半徑r,圓柱高h); scanf(%f,%f,&r,&h); /要求輸入圓半徑r和圓柱高h l=2*pi*r; /計算圓周長l s=r*r*pi; /計算圓面積s sq=4*pi*r*r; /計算圓球表面積sq vq=3.0/4.0*pi*r*r*r; /計算圓

12、球體積vq vz=pi*r*r*h; /計算圓柱體積vz printf(圓周長為: l=%6.2fn,l); printf(圓面積為: s=%6.2fn,s); printf(圓球表面積為: sq=%6.2fn,sq); printf(圓球體積為: v=%6.2fn,vq); printf(圓柱體積為: vz=%6.2fn,vz); return 0; 3-8-1#include int main() int c1,c2; /整型定義 printf(請輸入兩個整數(shù)c1,c2:); scanf(%d,%d,&c1,&c2); printf(按字符輸出結(jié)果:n); printf(%c,%cn,c1

13、,c2); printf(按ASCII碼輸出結(jié)果為:n); printf(%d,%dn,c1,c2); return 0;3-8-2#include int main() char c1,c2; /定義字符型變量 int i1,i2; /定義整型變量 printf(請輸入兩個字符c1,c2:); scanf(%c,%c,&c1,&c2); i1=c1; /賦值給整型變量 i2=c2; printf(按字符輸出結(jié)果:n); printf(%c,%cn,i1,i2); printf(按整數(shù)輸出結(jié)果:n); printf(%d,%dn,c1,c2); return 0;3-8-3#include i

14、nt main() char c1,c2; /定義為字符型 int i1,i2; /定義為整型 printf(請輸入兩個整數(shù)i1,i2:); scanf(%d,%d,&i1,&i2); c1=i1; /將整數(shù)賦值給字符變量 c2=i2; printf(按字符輸出結(jié)果:n); printf(%c,%cn,c1,c2); printf(按整數(shù)輸出結(jié)果:n); printf(%d,%dn,c1,c2); return 0;3-8#include int main()char c1,c2;printf(請輸入兩個字符c1,c2:);c1=getchar();c2=getchar();printf(用p

15、utchar語句輸出結(jié)果為:);putchar(c1);putchar(c2);printf(n);printf(用printf語句輸出結(jié)果為:);printf(%c %cn,c1,c2);return 0;第4章選擇結(jié)構(gòu)程序設(shè)計854.1選擇結(jié)構(gòu)和條件判斷854.2用if語句實現(xiàn)選擇結(jié)構(gòu)874.2.1用if語句處理選擇結(jié)構(gòu)舉例874.2.2if語句的一般形式 894.3關(guān)系運算符和關(guān)系表達式914.3.1關(guān)系運算符及其優(yōu)先次序914.3.2關(guān)系表達式924.4邏輯運算符和邏輯表達式924.4.1邏輯運算符及其優(yōu)先次序934.4.2邏輯表達式944.4.3邏輯型變量964.5條件運算符和條件表

16、達式974.6選擇結(jié)構(gòu)的嵌套994.7用switch語句實現(xiàn)多分支選擇結(jié)構(gòu)1024.8選擇結(jié)構(gòu)程序綜合舉例105習題1114-4-1#include int main() int a,b,c; printf(請輸入三個整數(shù):); scanf(%d,%d,%d,&a,&b,&c); if (ab) if (bc) printf(max=%dn,c); else printf(max=%dn,b); else if (ac) printf(max=%dn,c); else printf(max=%dn,a); return 0;4-4-2#include int main() int a,b,c,

17、temp,max; printf(請輸入三個整數(shù):); scanf(%d,%d,%d,&a,&b,&c); temp=(ab)?a:b; /*將a和b中的大者存入temp中*/ max=(tempc)?temp:c; /*將a和b中的大者與c比較,取最大者*/ printf(三個整數(shù)的最大數(shù)是%dn,max); return 0;4-5-2#include #include #define M 1000int main() int i,k; printf(請輸入一個小于%d的整數(shù)i:,M); scanf(%d,&i); while (iM) printf(輸入的數(shù)不符合要求,請重新輸入一個小于

18、%d的整數(shù)i:,M); scanf(%d,&i); k=sqrt(i); printf(%d的平方根的整數(shù)部分是:%dn,i,k); return 0;4-5#include #include #define M 1000int main() int i,k; printf(請輸入一個小于%d的整數(shù)i:,M); scanf(%d,&i); if (iM) printf(輸入的數(shù)不符合要求,請重新輸入一個小于%d的整數(shù)i:,M); scanf(%d,&i); k=sqrt(i); printf(%d的平方根的整數(shù)部分是:%dn,i,k); return 0;4-6.#include int ma

19、in() int x,y; printf(輸入x:); scanf(%d,&x); if(x1) /* x1 */ y=x; printf(x=%3d, y=x=%dn ,x,y); else if(x10) /* 1=x=10 */ y=3*x-11; printf(x=%d, y=3*x-11=%dn,x,y); return 0;4-7-1#include int main() int x,y; printf(enter x:); scanf(%d,&x); y=-1; if(x!=0) if(x0) y=1; else y=0; printf(x=%d,y=%dn,x,y); retu

20、rn 0;4-7-2#include int main() int x,y; printf(please enter x:); scanf(%d,&x); y=0; if(x=0) if(x0) y=1; else y=-1; printf(x=%d,y=%dn,x,y); return 0;4-8#include int main() float score; char grade; printf(請輸入學生成績:); scanf(%f,&score); while (score100|score0)printf(n 輸入有誤,請重輸);scanf(%f,&score); switch(in

21、t)(score/10) case 10:case 9: grade=A;break;case 8: grade=B;break;case 7: grade=C;break;case 6: grade=D;break;case 5:case 4:case 3:case 2:case 1:case 0: grade=E; printf(成績是 %5.1f,相應的等級是%cn ,score,grade);return 0;4-9#include #include int main() int num,indiv,ten,hundred,thousand,ten_thousand,place; /分

22、別代表個位,十位,百位,千位,萬位和位數(shù) printf(請輸入一個整數(shù)(0-99999):); scanf(%d,&num); if (num9999) place=5; else if (num999) place=4; else if (num99) place=3; else if (num9) place=2; else place=1; printf(位數(shù):%dn,place); printf(每位數(shù)字為:); ten_thousand=num/10000; thousand=(int)(num-ten_thousand*10000)/1000; hundred=(int)(num-

23、ten_thousand*10000-thousand*1000)/100; ten=(int)(num-ten_thousand*10000-thousand*1000-hundred*100)/10; indiv=(int)(num-ten_thousand*10000-thousand*1000-hundred*100-ten*10); switch(place) case 5:printf(%d,%d,%d,%d,%d,ten_thousand,thousand,hundred,ten,indiv); printf(n反序數(shù)字為:); printf(%d%d%d%d%dn,indiv,

24、ten,hundred,thousand,ten_thousand); break; case 4:printf(%d,%d,%d,%d,thousand,hundred,ten,indiv); printf(n反序數(shù)字為:); printf(%d%d%d%dn,indiv,ten,hundred,thousand); break; case 3:printf(%d,%d,%d,hundred,ten,indiv); printf(n反序數(shù)字為:); printf(%d%d%dn,indiv,ten,hundred); break; case 2:printf(%d,%d,ten,indiv)

25、; printf(n反序數(shù)字為:); printf(%d%dn,indiv,ten); break; case 1:printf(%d,indiv); printf(n反序數(shù)字為:); printf(%dn,indiv); break; return 0; 4-10-1#include int main() int i; double bonus,bon1,bon2,bon4,bon6,bon10; bon1=100000*0.1; bon2=bon1+100000*0.075; bon4=bon2+100000*0.05; bon6=bon4+100000*0.03; bon10=bon6+

26、400000*0.015; printf(請輸入利潤i:); scanf(%d,&i); if (i=100000) bonus=i*0.1; else if (i=200000) bonus=bon1+(i-100000)*0.075; else if (i=400000) bonus=bon2+(i-200000)*0.05; else if (i=600000) bonus=bon4+(i-400000)*0.03; else if (i=1000000) bonus=bon6+(i-600000)*0.015; else bonus=bon10+(i-1000000)*0.01; pr

27、intf(獎金是: %10.2fn,bonus); return 0; 4-10-2#include int main() int i; double bonus,bon1,bon2,bon4,bon6,bon10; int branch; bon1=100000*0.1; bon2=bon1+100000*0.075; bon4=bon2+200000*0.05; bon6=bon4+200000*0.03; bon10=bon6+400000*0.015; printf(請輸入利潤i:); scanf(%d,&i); branch=i/100000; if (branch10) branc

28、h=10; switch(branch) case 0:bonus=i*0.1;break; case 1:bonus=bon1+(i-100000)*0.075;break; case 2: case 3: bonus=bon2+(i-200000)*0.05;break; case 4: case 5: bonus=bon4+(i-400000)*0.03;break; case 6: case 7: case 8: case 9: bonus=bon6+(i-600000)*0.015;break; case 10: bonus=bon10+(i-1000000)*0.01; print

29、f(獎金是 %10.2fn,bonus); return 0; 4-11#include int main() int t,a,b,c,d; printf(請輸入四個數(shù):); scanf(%d,%d,%d,%d,&a,&b,&c,&d); printf(a=%d,b=%d,c=%d,d=%dn,a,b,c,d); if (ab) t=a;a=b;b=t; if (ac) t=a;a=c;c=t; if (ad) t=a;a=d;d=t; if (bc) t=b;b=c;c=t; if (bd) t=b;b=d;d=t; if (cd) t=c;c=d;d=t; printf(排序結(jié)果如下: n

30、); printf(%d %d %d %d n ,a,b,c,d); return 0; 4-12#include int main() int h=10; float x1=2,y1=2,x2=-2,y2=2,x3=-2,y3=-2,x4=2,y4=-2,x,y,d1,d2,d3,d4; printf(請輸入一個點(x,y):); scanf(%f,%f,&x,&y); d1=(x-x4)*(x-x4)+(y-y4)*(y-y4); /*求該點到各中心點距離*/ d2=(x-x1)*(x-x1)+(y-y1)*(y-y1); d3=(x-x2)*(x-x2)+(y-y2)*(y-y2); d

31、4=(x-x3)*(x-x3)+(y-y3)*(y-y3); if (d11 & d21 & d31 & d41) h=0; /*判斷該點是否在塔外*/ printf(該點高度為 %dn,h); return 0; 第5章循環(huán)結(jié)構(gòu)程序設(shè)計1145.1為什么需要循環(huán)控制1145.2用while語句實現(xiàn)循環(huán)1155.3用dowhile語句實現(xiàn)循環(huán)1175.4用for 語句實現(xiàn)循環(huán)1205.5循環(huán)的嵌套1245.6幾種循環(huán)的比較1255.7改變循環(huán)執(zhí)行的狀態(tài)1255.7.1用break語句提前終止循環(huán)1265.7.2用continue語句提前結(jié)束本次循環(huán)1275.7.3break語句和continu

32、e語句的區(qū)別1285.8循環(huán)程序舉例131習題1405-2#include #include / 程序中用到數(shù)學函數(shù)fabs,應包含頭文件math.nint main() int sign=1,count=0; / sign用來表示數(shù)值的符號,count用來統(tǒng)計循環(huán)次數(shù) double pi=0.0,n=1.0,term=1.0; / pi開始代表多項式的值,最后代表的值, n代表分母,term代表當前項的值 while(fabs(term)=1e-8) / 檢查當前項term的絕對值是否大于或等于10的(-6)次方 pi=pi+term; / 把當前項term累加到pi中 n=n+2; / n

33、+2是下一項的分母 sign=-sign; / sign代表符號,下一項的符號與上一項符號相反 term=sign/n; / 求出下一項的值term count+; / count累加1 pi=pi*4; / 多項式的和pi乘以4,才是的近似值 printf(pi=%10.8fn,pi); / 輸出的近似值 printf(count=%dn,count); / 輸出循環(huán)次數(shù) return 0;5-3#include int main() int p,r,n,m,temp; printf(請輸入兩個正整數(shù)n,m:); scanf(%d,%d,&n,&m); if (nm) temp=n; n=m

34、; m=temp; p=n*m; while(m!=0) r=n%m; n=m; m=r; printf(它們的最大公約數(shù)為:%dn,n); printf(它們的最小公約數(shù)為:%dn,p/n); return 0; 5-4#include int main() char c; int letters=0,space=0,digit=0,other=0; printf(請輸入一行字符:n); while(c=getchar()!=n) if (c=a & c=A & c=0 & c=9) digit+; else other+; printf(字母數(shù):%dn空格數(shù):%dn數(shù)字數(shù):%dn其它字符數(shù)

35、:%dn,letters,space,digit,other); return 0; 5-5#include int main() int a,n,i=1,sn=0,tn=0; printf(a,n=:); scanf(%d,%d,&a,&n); while (i=n) tn=tn+a; /*賦值后的tn為i個 a組成數(shù)的值*/ sn=sn+tn; /*賦值后的sn為多項式前i項之和*/ a=a*10; +i; printf(a+aa+aaa+.=%dn,sn); return 0; 5-6#include int main() double s=0,t=1; int n; for (n=1;

36、n=20;n+) t=t*n; s=s+t; printf(1!+2!+.+20!=%22.15en,s); return 0;5-7#include int main() int n1=100,n2=50,n3=10; double k,s1=0,s2=0,s3=0; for (k=1;k=n1;k+) /*計算1到100的和*/ s1=s1+k; for (k=1;k=n2;k+) /*計算1到50各數(shù)的平方和*/ s2=s2+k*k; for (k=1;k=n3;k+) /*計算1到10的各倒數(shù)和*/ s3=s3+1/k; printf(sum=%15.6fn,s1+s2+s3); re

37、turn 0; 5-8#include int main() int i,j,k,n; printf(parcissus numbers are ); for (n=100;n1000;n+) i=n/100; j=n/10-i*10; k=n%10; if (n=i*i*i + j*j*j + k*k*k) printf(%d ,n); printf(n); return 0; 5-9-1#define M 1000 /*定義尋找范圍*/#include int main() int k1,k2,k3,k4,k5,k6,k7,k8,k9,k10; int i,a,n,s; for (a=2;

38、a=M;a+) /* a是2-1000之間的整數(shù),檢查它是否完數(shù) */ n=0; /* n用來累計a的因子的個數(shù) */ s=a; /* s用來存放尚未求出的因子之和,開始時等于a */ for (i=1;i1) printf(%d,%d,k1,k2); /* n1表示a至少有2個因子 */ if (n2) printf(,%d,k3); /* n2表示至少有3個因子,故應再輸出一個因子 */ if (n3) printf(,%d,k4); /* n3表示至少有4個因子,故應再輸出一個因子 */ if (n4) printf(,%d,k5); /* 以下類似 */ if (n5) printf(

39、,%d,k6); if (n6) printf(,%d,k7); if (n7) printf(,%d,k8); if (n8) printf(,%d,k9); if (n9) printf(,%d,k10); printf(n); return 0; 5-9-2#include int main() int m,s,i; for (m=2;m1000;m+) s=0; for (i=1;im;i+) if (m%i)=0) s=s+i; if(s=m) printf(%d,its factors are ,m); for (i=1;im;i+) if (m%i=0) printf(%d ,i

40、); printf(n); return 0; 5-10#include int main() int i,n=20; double a=2,b=1,s=0,t; for (i=1;i=n;i+) s=s+a/b; t=a, a=a+b, b=t; printf(sum=%16.10fn,s); return 0; 5-11#include int main() double sn=100,hn=sn/2; int n; for (n=2;n=10;n+) sn=sn+2*hn; /*第n次落地時共經(jīng)過的米數(shù)*/ hn=hn/2; /*第n次反跳高度*/ printf(第10次落地時共經(jīng)過%f

41、米n,sn); printf(第10次反彈%f米n,hn); return 0; 5-12#include int main() int day,x1,x2; day=9; x2=1; while(day0) x1=(x2+1)*2; /*第1天的桃子數(shù)是第2天桃子數(shù)加1后的2倍.*/ x2=x1; day-; printf(total=%dn,x1); return 0; 5-13#include #include int main() float a,x0,x1; printf(enter a positive number:); scanf(%f,&a); x0=a/2; x1=(x0+

42、a/x0)/2; do x0=x1; x1=(x0+a/x0)/2; while(fabs(x0-x1)=1e-5); printf(The square root of %5.2f is %8.5fn,a,x1); return 0; 5-14#include #include int main() double x1,x0,f,f1; x1=1.5; do x0=x1; f=(2*x0-4)*x0+3)*x0-6; f1=(6*x0-8)*x0+3; x1=x0-f/f1; while(fabs(x1-x0)=1e-5); printf(The root of equation is %5

43、.2fn,x1); return 0; 5-15#include #include int main() float x0,x1,x2,fx0,fx1,fx2; do printf(enter x1 & x2:); scanf(%f,%f,&x1,&x2); fx1=x1*(2*x1-4)*x1+3)-6; fx2=x2*(2*x2-4)*x2+3)-6; while(fx1*fx20); do x0=(x1+x2)/2; fx0=x0*(2*x0-4)*x0+3)-6; if (fx0*fx1)=1e-5); printf(x=%6.2fn,x0); return 0; 5-16#inclu

44、de int main() int i,j,k; for (i=0;i=3;i+) for (j=0;j=2-i;j+) printf( ); for (k=0;k=2*i;k+) printf(*); printf(n); for (i=0;i=2;i+) for (j=0;j=i;j+) printf( ); for (k=0;k=4-2*i;k+) printf(*); printf(n); return 0; 5-17#include int main() char i,j,k; /*是a的對手;j是b的對手;k是c的對手*/ for (i=x;i=z;i+) for (j=x;j=z;j+) if (i!=j) for (k=x;k=z;k+)if (i!=k & j!=k) if (i!=x & k!=x & k!=z) printf(A-%cnB-%cnC-%cn,i,j,k); return 0; 第6章利用數(shù)組處理批量數(shù)據(jù)1426.1怎樣定義和引用一維數(shù)組1426.1.1怎樣定義一維數(shù)組1436.1.2怎樣引用一維數(shù)組元素1446.1.3一維數(shù)組的初始化1456.1.4一維數(shù)組程序舉例1466

展開閱讀全文
溫馨提示:
1: 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
2: 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
3.本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
5. 裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

相關(guān)資源

更多
正為您匹配相似的精品文檔
關(guān)于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

copyright@ 2023-2025  zhuangpeitu.com 裝配圖網(wǎng)版權(quán)所有   聯(lián)系電話:18123376007

備案號:ICP2024067431-1 川公網(wǎng)安備51140202000466號


本站為文檔C2C交易模式,即用戶上傳的文檔直接被用戶下載,本站只是中間服務(wù)平臺,本站所有文檔下載所得的收益歸上傳人(含作者)所有。裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對上載內(nèi)容本身不做任何修改或編輯。若文檔所含內(nèi)容侵犯了您的版權(quán)或隱私,請立即通知裝配圖網(wǎng),我們立即給予刪除!