中央電大C語言程序設計形成性考核冊加答案_第1頁
中央電大C語言程序設計形成性考核冊加答案_第2頁
中央電大C語言程序設計形成性考核冊加答案_第3頁
中央電大C語言程序設計形成性考核冊加答案_第4頁
中央電大C語言程序設計形成性考核冊加答案_第5頁
已閱讀5頁,還剩17頁未讀 繼續免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、c 語言程序設計形成性作業一一、選擇題1.在每個 c 語言程序中都必須包含有這樣一個函數,該函數的函數名為(a) 。amain bmain cname dfuntion 2c 語言原程序文件的缺省擴展名為(d) 。acpp bexe cobj d c 3由 c 語言目標文件連接而成的可執行的缺省擴展名為(b) 。acpp bexe cobj d c 4程序運行中需要從鍵盤輸入多于一個數據時,各數據之間應使用(d)符號作為分隔符。a空格或逗號b逗號或回車c回車或分號d空格或回車5每個 c 語言程序的編譯錯誤分為(b)類。a1 b 2 c3 d4 6設 x 和 y 均為邏輯值,則x & y

2、 為真的條件是(a) 。a它們均為真b其中一個為真c它們均為假d其中一個為假7設有語句“ int a=12;a+=a*a; ” ,則執行結束后,a 的值為( c) 。a12 b144 c156 d 288 8x0 & x=10的相反表達式為(a) 。ax10 bx10 cx=0 | x0 & x10 9字符串“ a+b=12n”的長度為(b) 。a6 b 7 c8 d9 10在下列符號常量定義中。錯誤的定義語句格式為(c) 。aconst m1=10; bconst int m2=20; cconst m3 10 dconst char mark= 311帶有隨機函數的表達式r

3、and()%20 的值在( c)區間內,a119 b120 c 019 d020 12當處理特定問題時的循環次數已知時,通常采用(a)循環來解決。afor bwhile cdo-while dswitch 13在 switch 語句的每個case 塊中,假定都是以break 語句結束的,則此switch 語句容易被改寫為( b)語句。afor b if cdo dwhile 14 for 語句能夠被改寫為(d)語句。a復合bif cswitch dwhile 15下面循環語句執行結束后輸出的i 值為( b) 。for(int i=0;in/2)coutiendl;break;an/2 bn/2

4、+1 cn/2-1 dn-1 16在下面循環w 語句中內層循環體s 語句的執行次數為(d) 。for(int i=0;in;i+) for(int j=i;jn;j+)s; an2 b(n+1)/2 c n(n-1)/2 dn(n+1)/2 17在下面的do 循環語句中,其循環體被執行的次數為(a ) 。int i=0;do i+;while(i*i5 的相反表達式為_x+yb | b=5 的相反表達式為_a5 | by 邏輯值為 _false_。35若 x=5,y=10 ,則 x=y 邏輯值為 _true_。36假定 x=5,則執行“ a=(x?10:20);”語句后a的值為 _10_。37

5、執行“ typedef int datatype;”語句后,在使用int 定義整型變量的地方都可以使用_datatype_來定義整型變量。38在 switch 語句中,每個語句標號所含保留字case 后面的表達式必須是_整型 _。39作為語句標號使用的c 保留字 case和 default 只能用于 _switch_語句的定義體中。40在switch 語句時,在進行作為條件的表達式求值后,將從某個匹配的標號位置起向下執行,當碰到下一個標號位置時(停止/不停止) _不停止 _執行。41若 do 循環的“尾”為“while(+i10) ” ,并且i 的初值為0,同時在循環體不會修改i的值,由循環體

6、將被重復執行_10_次后正常結束。42當在程序執行到_break_語句時,將結束本層循環語句或switch 語句的執行。43在程序中執行到_return_語句時,將結束所在函數的執行過程,返回到調用該函數的位置。44在程序執行完_主(main)_函數調用后,將結束整個程序的執行過程,返回到操作系統或 c 語句集成開發環境界面窗口。三、寫出下列每個程序運行后的輸出結果1. #include void main() int x=5;switch(2*x-3) case 4:printf(%d ,x); case 7:printf(%d ,2*x+1); case 10:printf(%d ,3*x

7、-1);break; default:printf(%s ,defaultn); printf(%sn,switch end.); 輸出結果為:11 14 switch end. press any key to continue 2. #include void main() int i,s=0; for(i=1;i=6;i+) s+=i*i; printf(s=%dn,s); 輸出結果為:s=91. press any key to continue 3. #include void main() int i,s1=0,s2=0; for(i=0;i10;i+) if(i%2)s1+=i;

8、 else s2+=i; printf(%d %dn,s1,s2); 輸出結果為:25 20. press any key to continue 4. #include void main() int n=10,y=1; while(n-)y+;y+; printf(y=%dn,y); 輸出結果為: y=21. press any key to continue 5. #include void main() int f,f1,f2,i; f1=f2=1; printf(%d %d ,f1,f2); for(i=3;i=10;i+) f=f1+f2; printf(%d ,f); if(i%

9、5=0)printf(n); f1=f2; f2=f; printf(n); 輸出結果為:1 1 2 3 5 8 13 21 34 55 press any key to continue 6. #include #include void main() int i,n; for(n=2;n=20;n+) int temp=(int)sqrt(n);/sqrt(n)求出 n 的平方根并取整for(i=2;itemp)printf(%d ,n); printf(n); 輸出結果為:2 3 5 7 11 13 17 19 press any key to continue 7. #include

10、#include const int m=20; void main() int i,c2,c3,c5; c2=c3=c5=0; for(i=1;i=m;i+) if(i%2=0)c2+; if(i%3=0)c3+; if(i%5=0)c5+; printf(%d %d %dn,c2,c3,c5); 輸出結果為:10 6 4 press any key to continue 8. #include #include const int m=20; void main() int i,s; for(i=1,s=0;i15;i+) if(i%2=0 | i%3=0)continue; print

11、f(%d ,i); s+=i; printf(%dn,s); 輸出結果為:1 5 7 11 13 37 press any key to continue c 語言程序設計形成性考核冊參考答案作業二一、選擇題1.在下面的一維數組定義中,(c)語句有語法錯誤。a int a=1,2,3; bint a10=0; c int a; dint a5;n 2在下面的二維數組定義中,(c)語句是正確的。a int a5; bint a5; cint a3=1,3,5,2; dint a(10) 3 假定一個二維數組的定義語句為“int a34=3,4,2,8,6;” , 則元素 a12 的值為(c) 。

12、a2 b 4 c6 d8 4 假定一個二維數組的定義語句為“int a34=3,4,2,8,6;” , 則元素 a21 的值為(a) 。a0 b 4 c8 d6 5將兩個字符串連接起來組成一個字符串時,選用(c)函數。astrlen() bstrcap() cstrcat() dstrcmp() 二、填空題1假定一維數組的定義為“char * a8; ” ,則該數組所含元素的個數為_8_。2假定一維數組的定義為“char * a8; ” ,則該數組所占存儲空間的字節數為_32_。3假定二維數組的定義為“int a35 ” ,則該數組所占存儲空間的字節數為_60_。4假定二維數組的定義為“cha

13、r amn; ” ,則該數組所所含元素的個數為_m*n_ 。5假定二維數組的定義為“double amn; ” ,則每個數組元素的行下標取值范圍在_0m-1_ 之間。6假定二維數組的定義為“double amn; ” ,則每個數組元素的列下標取值范圍在_0n-1_ 之間。7使用“typedef char bb1050;”語句定義 _bb_為含有 10 行 50 列的二維字符數組類型。8存儲字符 a需要占用存儲器的_1_個字節空間。9空字符串的長度為_0_。10存儲一個空字符串需要占用_1_個字節。11字符串”數據”的長度為_11_。12用于存儲一個長度為n 的字符串的字符數組的長度至少為_n+

14、1_。13 strcmp 函數用于進行兩個字符串之間的_大小比較 _。14 strcpy 函數用于把一個字符串_復制到 _另一個字符數組空間中。15一個二維字符數組a1020 能夠存儲 _ 10_個字符串。16一個二維字符數組a1020 能夠存儲的每個字符串的長度至多為_19_. 三、寫出下列每個程序運行后的輸出結果1. #include void main() int a10=12,39,26,41,55,63,72,40,83,95; int i,i1=0,i2=0; for(i=0;i10;i+) if(ai%2=1)i1+;else i2+; printf(%d %dn,i1,i2);

15、 輸出結果為:6 4 press any key to continue 2. #include #include void main() int i; char *a5=student,worker,cadre,soldier,peasant; char *p1,*p2; p1=p2=a0; for(i=0;i0)p1=ai; if(strcmp(ai,p2)0)p2=ai; printf(%s %sn,p1,p2); 輸出結果為: worker cadre press any key to continue 3. #include int a10=4,5,6,15,20,13,12,7,8

16、,9; void main() int i,s0,s1,s2; s0=s1=s2=0; for(i=0;i10;i+) switch(ai%3) case 0:s0+=ai;break; case 1:s1+=ai;break; case 2:s2+=ai;break; printf(%d %d %dn,s0,s1,s2); 輸出結果為: 42 24 33 press any key to continue 4. #include void main() char a=abcdbfbgacd; int i1=0,i2=0,i=0; while(ai) if(ai=a)i1+; if(ai=b)

17、i2+; i+; printf(%d %d %dn,i1,i2,i); 輸出結果為: 2 3 11 press any key to continue 5. #include void main() int a34=1,2,7,8,5,6,10,6,9,12,3,4; int m=a00; int ii=0,jj=0; int i,j; for(i=0;i3;i+) for(j=0;jm)m=aij;ii=i;jj=j; printf(%d %d %dn,ii,jj,aiijj); 輸出結果為: 2 1 12 press any key to continue 6. #include void

18、 main() int a,b; for(a=1,b=2;b50;) printf(%d %d ,a,b); a=a+b; b=a+b; printf(n); 輸出結果為: 1 2 3 5 8 13 21 34 press any key to continue 四、寫出下列每個函數的功能1. #include int sa(int a,int b) if(ab)return 1; else if(a=b)return 0; else return -1; 函數功能為:根據實參a 大于、等于或小于實參b,返回 1,0 或-1 2. #include int sc(int a,int b,int

19、 c) if(a=b & a=c)return a; if(b=a & b=c)return b; return c; 函數功能為:返回實參a、 b、c 中的最大數3.double sf(double x,int n) /n為大于等于0 的整數double p=1,s=1; for(i=1;i=n;i+) p*=x; s+=p/(i+1); return s; 函數功能為:計算x+x2/2+x3/3+ ,+xn/(n+1) 的值4. #include int sc(int x) int a=(int)sqrt(x); int i=2; while(i=a) if(x%i=0)b

20、reak; i+; if(i=0)return 0;else return 1; 函數功能為:判斷一個整數是否是素數5. #include void trans(int x) char a10; int i=0,rem; do rem=x%16; x=x/16; if(rem0)printf(%c,a-i); printf(n); 函數功能為: 將一個整數化成十六進制數五、根據下列每個題目要求編寫程序1.編寫一個函數,函數頭格式為“void fun4(char *a , int b) ” ,分別求出由字符指針a所指向的字符串中包含的每種十進制數字出現的次數,把統計結果保存在數組b的相應元素。#

21、include void fun4(char* a,int b) do if(*a=0 & *a=9)b*a-48+; while(*a+); /*void main() char * a=122333444499888; int b10=0; fun4(a,b); for(int i=0;i10;i+) printf(%d ,bi); */ 2. 編寫一個函數,函數頭格式為“double mean(double amn , int m , int n)” ,要求返回二維數組amn中所有元素的平均值,假定在計算過程是采用變量v 存放平均值。#include const int m=2,

22、n=3; double mean(double amn, int m,int n ) double v=0; for(int i=0;im;i+)for(int j=0;jn;j+) v+=aij; return v/(m*n); /*void main() double a23=1,2,3,4,5,6; printf(%lfn,mean(a,2,3); */ 3. 編寫一個遞歸函數 “int ff(int a , int n) ” , 求出數組a 中所有元素n 個元素之積并返回。#include int ff(int a , int n) int mul=1; if(n=1)mul*=a0;

23、 else mul=an-1*ff(a,n-1); return mul; /*void main() int a6=1,2,3,4,5,6; printf(%dn,ff(a,6); */ 4. 編寫一個主函數,利用while 循環,求出并顯示滿足不等式1+1/2+1/3+ ,+1/n5 的最小 n 值。#include void main() double sum=0; int n=1; while(true) if(sum + 1/(double)n 5)break; else sum += 1/(double)n; n+; printf(%d, %lfn,n,sum); 5. 編寫一個主

24、函數,求滿足不等式22+42+,+n21000 的最大 n 值,假定分別用i和 s 為取偶數值和累加值的變量,并限定使用do 循環編程。#include void main() int s=0,i=2; do s+=i*i; if(s+(i+2)*(i+2)=1000)break; else i+=2; while(true); printf(i=%d,s=%d,i,s); 6.編寫一個主函數,計算并輸出n 的值,其中n 值由鍵盤輸入。#include void main() int s=0,n; printf( 請輸入 n 的值: ); scanf(%d,&n); for(int i

25、=1;i=n;i+)s+=i*i; printf(n=%d,s=%d,n,s); c 語言程序設計形成性考核冊參考答案作業三1. 在下面的( c)函數聲明語句存在語法錯誤。a aa(int a,int b); baa(int ,int) caa(int a;int b) daa(int a,int) 2在下面的( c)不能作為函數的返回類型。avoid b int cnew dlong 3下面正確的函數原型語句是(b) 。a int function(void a); b void function(int); cint function(a); d void int(double a); 4

26、函數調用func(exp1,exp2),exp3*exp4-exp5) 中所含實參的個數為(b)個。a1 b 2 c4 d5 5下面的標識符中, (c)是文件級作用域。a函數形參b語句標號c外部靜態類標識符d自動類標識符6下面的標識符中, (b)具有全局級作用域。a函數形參b全局變量c內部靜態類標識符d自動變量符7假定p 是一個指向float 型數據的指針,則p+1 所指數據的地址比p 所指數據的地址大( c )字節。a1 b2 c4 d8 8假定 a 為一個字符數組名,則a8的地址比該數組的首地址大(b )個字節。a4 b8 c16 d32 9假定 a 為一個數組名,則下面的(b )表示有錯

27、誤。aai b *a+ c *a d*(a+1) 10用 calloc 函數創建具有10 個整型元素的一維數組的正確語句是(c ) 。a int *p=calloc(10,2); bint *p=callo(10; cint *p=calloc(10,4); dint *p=malloc(10); 11假定變量m 定義為 “int m=7;”,則定義p 的正確語句為(b ) 。a int p=&m; bint *p=&m; cint &p=*m; d int *p=m; 12假定 k 是一個 double 類型的變量,則定義指向k 的變量 p 的正確語句為(b ) 。a

28、double p=&k; bdouble *p=&k; cdouble &p=*k; dchar *p=”thank you! ”;13假定一條定義語句為“int a10,x,*pa=a; ” ,若要把數組a 中下標為3 的元素賦值給x,則不正確的語句為(d ) 。ax=pa3; bx=*(a+3); ca=a3; dx=*pa+3; 14假定有定義“int b10;int *pb; ” ,則不正確的賦值語句為(c ) 。apb=b; bpb=&b0; cpb=b+2; dpb=b5; 15假定指針變量p 定義為“ int *p=new int(100); ”

29、,要釋放p 所指向的動態內存,應使用語句(d ) 。adeletep; bdelete *p; cdelete &p; d delete p; 16假定指針變量p 定義為“ int *p=calloc(30,sizeof(int);” ,要釋放 p 所指向的動態內存,應使用語句(d ) 。adeletep; bdeldete(p); cfreep; dfree(p); 1在 c 語言中,一個函數由函數頭和_函數體 _組成。2在函數外定義的變量稱為全局變量,若沒有被初始化則系統隱含對它所賦的初值為_0_。3如果一個函數只允許同一程序文件中的函數調用,則應在訪函數定義前加上的c 保留字為為

30、 _static_。4如果一個函數直接或間接地調用自身,這樣的調用被稱為_遞歸 _調用。5調用系統函數時,要先使用#include 命令包含該函數的原型語句所在_頭_文件。6函數形參的作用域是該函數的_內部 _。7假定 p 所指對象的值為25,p+1 所指對象的值為46,則 *p+的值為 _25_。8假定 p 所指對象的值為25,p+1 所指對象的值為46,則 *+p 的值為 _46_。9假定 p 所指對象的值為25,p+1 所指對象的值為46,則執行“ *(p+); ”語句后, p 所指對象的值為 _46_。10假定 a 是一個指針數組,則a+1 所指對象的地址比a 地址大 _4_字節。11

31、 若要把一個整型指針p 轉換為字符指針, 則采用的強制轉換表達式為_(char*)p_ 。12假定一個數據對象為int* 類型,則指向該對象的指針類型為_int*_ 。13假定 p 是一個指向整數對象的指針,則用_&p_ 表示指針變量p 的地址。14若 p 指向 x,則 _*p_與 x 的等價的。15 null 是一個符號常量,通常作為空指針值,它值為_ 0 (ascii 碼 0)_。三、寫出下列每個程序運行后的輸出結果1. #include void sb(char ch) switch (ch) case a:case a: printf(ww);break; case b:cas

32、e b: printf(gg);break; case c:case c: printf(pp);break; default:printf(bb);break; void main() char a1=b,a2=c,a3=f; sb(a1);sb(a2); sb(a3);sb(a); printf(n); 輸出結果為:ggppbbww press any key to continue 2. #include #include double sd(int a,int b,char op) double x; switch(op) case +:x=a+b;break; case -:x=a-

33、b;break; case *:x=a*b;break; case /:if(b)x=(double)a/b; else exit(1); break; default:( 運算符錯! n);exit(1); return x; void main() int x=20,y=8; printf(%3.2lf ,sd(x,y,-); printf(%3.2lf ,sd(x,y,*); printf(%3.2lf ,sd(x,y,/); 輸出結果為:12.00 160.00 2.50 press any key to continue 3. #include void wf(int x,int y

34、) x=x+y; y=x+y; printf(subs:x,y=%d,%dn,x,y); void main() int x=18,y=23; printf(main:x,y=%d,%dn,x,y); wf(x,y); x=2*x; printf(main:x,y=%d,%dn,x,y); 輸出結果為:main:x,y=18,23 subs:x,y=41,64 main:x,y=36,23 press any key to continue 4. #include #include void fun(char ss); void main() char s15=567891234; fun(s

35、); printf(%sn,s); void fun(char ss) int i,n=strlen(ss); for(i=0;in/2;i+) char c=ssi; ssi=ssn-1-i; ssn-1-i=c; 輸出結果為:432198765 press any key to continue 5. #include void insertsort(int a,int n) int i,j,x; for(i=1;i=0;j-)/為 x 順序向前尋找合適的插入位置if(xaj)aj+1=aj; else break; aj+1=x; void main() int i; int a6=20

36、,15,32,47,36,28; insertsort(a,6); for(i=0;i6;i+)printf(%d ,ai);printf(n); 輸出結果為:47 36 32 28 20 15 press any key to continue 6. #include void main() int a8=3,5,7,9,11,13,15,17; int i,*p=a; for(i=0;i8;i+); printf(%5d ,*p+); if( (i+1)%4=0 )printf(n); 輸出結果為:3 5 7 9 11 13 15 17 press any key to continue

37、7. #include int la(int *a,int n) int i,s=0; for(i=0;in;i+) s+=ai; return s; void main() int a=5,10,15,20,25,30; int b=la(a,4); int c=la(a+2,3); printf(%d %dn,b,c); 輸出結果為: 50 60 press any key to continue 8. #include int lb(int *a,int n) int i,s=1; for(i=0;in;i+)s*=*a+; return s; void main() int a=1,2

38、,3,4,2,4,5,2; int b=lb(a,4)+lb(&a3,4); printf(b=%dn,b); 輸出結果為:b=184 press any key to continue 四、寫出下列每個函數的功能1. #include int wb(int a,int n,int x) for(int i=0;in;i+) if(ai=x)return 1; return 0; 函數功能為:根據整型數組元素中是否能找到整數x,返回 1 或 0 2. #include int wc(int a,int n,int k) int c=0;for(int i=0;i=k)c+; retur

39、n c; 函數功能為:返回數組中前n 個其值大于等于k 的元素之和3. #include #include #include const int n=10; int ff(int x,int y) int z; printf(%d + %d = ,x,y); scanf(%d,&z); if(x+y=z)return 1;else return 0; void main() int i,a,b,c=0; srand(time(0); /初始化隨機數系列for(i=0;in;i+) a=rand()%20+1; /rand90 函數產生0-32767 之間的一個隨機數b=rand()%2

40、0+1; c+=ff(a,b); printf( 得分: %dn,c*10); 函數功能為:函數 ff 讓兩個數相加,要求輸入其和,判斷結果是否正確。在主函數中用隨機函數產生兩個 20 以內的隨機整數,通過10 次調用這個函數,算對一次得10 分,計算所得分4. int fun6(int m,int n,int b=2) if(mb & nb)return m*n; else if(m%b=0 & n%b=0)return b*fun6(m/b,n/b,b); else return fun6(m,n,+b); 函數功能為:此函數帶有一個默認參數,若使用默認值,則通過遞歸調用,

41、返回前2 參數的最小公倍數;不使用默認值時,若最后一個參數不小于前2 個參數,則返回前2 參數之乘積;否則,通過遞歸調用,返回前2 參數最小公倍數的n 倍數。5. #include #include void li(int n) int * a= 電腦商場特別版2 malloc(n*sizeof(int); int i; for(i=0;i=0;i-)printf(%d ,*(a+i); printf(n); free(a); 函數功能為:將從鍵盤輸入的n 個整數逆序輸出6. #include int lk(double a,int n) double s=0;int i,m=0; for(i

42、=0;in;i+)s+=ai; s/=n; for(i=0;i=s)m+; return m; 函數功能為:求不小于數組元素之平均值的各元素之和(前n 個)c 語言程序設計形成性考核冊參考答案作業四1. 假定有“ struct bookchar title40;float price;struct book *book;” ,則不正確的語句為( a) 。astruct book *x=malloc(book); bstruct book x= “c+ programming” ,27.0; cstruct book *x=malloc(sizeof(book); dstruct book *x

43、=&book; 2. 假定有“ struct bookchar title40;float price; book;” ,則正確的語句為(b) 。astruct book x=&book; bstruct book *x=&book; cstruct book x=calloc(book); dstruct book *x=book; 3表示文件結束的符號常量為(c) 。aeof beof ceof dfeof 4c 語言中系統函數fopen() 是( d)一個數據文件的函數。a讀取b寫入c關閉d打開5從一個數據文件中讀入以換行符結束的一行字符串的函數為(b) 。age

44、ts() b fgets() c getc() dfgetc() 6向一個二進制文件寫入信息的函數fwrite() 帶有( d)參數。a1 b2 c3 d 4 1假定一個結構類型的定義為“struct aint a,b;a*c; ” ,則該類型的大小為_12_字節。2 假定一個結構類型的定義為“struct bint a5,char *b;” , 則該類型的大小為_24_字節。3假定一個結構類型的定義為“struct dint a;unionint b;double c;struct d* d2;” ,則該類型的大小為 _20 _字節。4假定要動態分配一個類型為struct worker 的具

45、有 n 個元素的數組,并由r 指向這個動態數組,則使用語句的表達式為struct worker* r=_(worker*)malloc(n*sizeof(worker);_。5假定要訪問一個結構x 中的由 a 指針成員所指向的對象,則表示方法為_x.(*a)_ 。6假定要訪問一個結構指針p 所指向對象中的b 指針成員所指的對象,則表示方法為 _ *(p-b)_ 7與結構成員訪問表達式(*fp).score 等價的表達式是_fp-score_。三、寫出下列每個程序運行后的輸出結果1. #include struct worker char name15; / 姓名int age; /年齡floa

46、t pay; / 工資; void main() struct worker x=wanghua,52,23.50; struct worker y,*p; y=x;p=&x; printf(%s %d %6.2fn,,y .age,y.pay); printf(%s %d %6.2fn,p-name,p-age,p-pay); 輸出結果為: wanghua 52 23.50 wanghua 52 23.50 press any key to continue 2. #include #include struct worker char name15; / 姓名int a

47、ge; /年齡float pay; / 工資; void main() struct worker x; char *t=louting; int d=38;float f=493; strcpy(,t); x.age=d;x.pay=f; x.age+;x.pay*=2; printf(%s %d %6.2fn,,x.age,x.pay); 輸出結果為:louting 39 986.00 press any key to continue 3. #include #include struct worker char name15; / 姓名int age; /年齡f

48、loat pay; / 工資; int less(struct worker r1,struct worker r2) if(r1.ager2.age)return 1; else return 0; void main() struct worker a4=abc,25,420,def,58,638,ghi,49,560,jkl,36,375; struct worker x=a0; int i; for(i=1;i4;i+) if(less(x,ai)x=ai; printf(%s %d %6.2fn,,x.age,x.pay); 輸出結果為: def 58 638.00 press any key to continue 四、寫出下列每個函數的功能1. void qa(struct worker a,int n) int i; for(i=0;in;i+) scanf(%s %d %f,&,ai.age,ai.pay); 假定結構struct worker 的定義如下:#

溫馨提示

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

評論

0/150

提交評論