歡迎來到裝配圖網(wǎng)! | 幫助中心 裝配圖網(wǎng)zhuangpeitu.com!
裝配圖網(wǎng)
ImageVerifierCode 換一換
首頁 裝配圖網(wǎng) > 資源分類 > DOC文檔下載  

C語言程序設(shè)計(jì)教程-李含光-鄭關(guān)勝-清華大學(xué)出版社習(xí)題答案習(xí)題答案[完美打印版]

  • 資源ID:9920227       資源大?。?span id="vemerxa" class="font-tahoma">119KB        全文頁數(shù):27頁
  • 資源格式: DOC        下載積分:15積分
快捷下載 游客一鍵下載
會(huì)員登錄下載
微信登錄下載
三方登錄下載: 微信開放平臺(tái)登錄 支付寶登錄   QQ登錄   微博登錄  
二維碼
微信掃一掃登錄
下載資源需要15積分
郵箱/手機(jī):
溫馨提示:
用戶名和密碼都是您填寫的郵箱或者手機(jī)號(hào),方便查詢和重復(fù)下載(系統(tǒng)自動(dòng)生成)
支付方式: 支付寶    微信支付   
驗(yàn)證碼:   換一換

 
賬號(hào):
密碼:
驗(yàn)證碼:   換一換
  忘記密碼?
    
友情提示
2、PDF文件下載后,可能會(huì)被瀏覽器默認(rèn)打開,此種情況可以點(diǎn)擊瀏覽器菜單,保存網(wǎng)頁到桌面,就可以正常下載了。
3、本站不支持迅雷下載,請(qǐng)使用電腦自帶的IE瀏覽器,或者360瀏覽器、谷歌瀏覽器下載即可。
4、本站資源下載后的文檔和圖紙-無水印,預(yù)覽文檔經(jīng)過壓縮,下載后原文更清晰。
5、試題試卷類文檔,如果標(biāo)題沒有明確說明有答案則都視為沒有答案,請(qǐng)知曉。

C語言程序設(shè)計(jì)教程-李含光-鄭關(guān)勝-清華大學(xué)出版社習(xí)題答案習(xí)題答案[完美打印版]

1 第 1章習(xí)題參考答案 1 單項(xiàng)選擇題 1 A 2 C 3 D 4 C 5 B 2 填空題 1 函數(shù) 2 主函數(shù) main 3 printf scanf 第 2章習(xí)題參考答案 1 單項(xiàng)選擇題 1 5 CBCCC 6 10 CDCDC 11 13 DBB 2 填空題 1 1 2 26 3 6 4 2 4 10 6 5 3 000000 6 雙精度 double 7 9 8 字母 數(shù)字 下劃線 9 13 700000 10 11 11 m 10 10 100 m 100 10 m 10 12 0 13 10 9 11 15 x 0 scanf lf if x 1 0 else y 3 x 11 printf lf n y return 0 2 include int main double x y z min scanf lf lf lf if x y min y else min x if min z min z printf min lf n min return 0 3 include int main int y m d flag s 0 w i scanf d d d flag y 4 0 w y 1 365 y 1 4 y 1 100 y 1 400 7 for i 1 i2 s s 1 s w s 7 if s 0 printf 星期日 n 3 else printf 星期 d n s return 0 4 include int main float p r scanf f if p10 printf f n r return 0 5 include int main char c while c getchar n if c a putchar c return 0 6 include int main int m k 2 printf 輸入一個(gè)正整數(shù) n scanf d while k m if m k 0 printf 4d k m m k else k printf 4d n m return 0 7 include int main int a n s 0 p 0 i scanf d d for i 1 i n i p p 10 a s s p printf d n s 4 return 0 8 include int main int i j k for i 1 i 9 i for j 0 j 9 j for k 0 k 9 k printf 5d 100 i 10 j k return 0 9 include include int main float a 10 b 10 x f1 f2 f f1 2 a 4 a 3 a 6 f2 2 b 4 b 3 b 6 do x a b 2 f 2 x 4 x 3 x 6 if f f1 1e 6 printf 6 2f n x return 0 10 include include int main int n 2 double eps t s 0 x scanf lf lf t x s t while fabs t eps t t 2 n 3 x x 2 n 2 s s t 2 n n printf d lf n n s return 0 11 include int main unsigned long s t 0 p 1 scanf u while s 0 if s 10 2 0 t t s 10 p p p 10 s s 10 printf u n t return 0 5 第 4章習(xí)題參考答案 1 單項(xiàng)選擇題 1 5 DDDBD 6 10 BADCD 11 14 BDAB 2 填空題 1 2 2 嵌套 遞歸 3 全局變量 局部變量 靜態(tài)變量 動(dòng)態(tài)變量 4 auto static register extern 5 外部變量 6 編譯 運(yùn)行 3 閱讀程序 指出結(jié)果 1 15 2 5 3 5 4 3 4 i 5 i 2 i 2 i 4 i 2 5 求水仙花數(shù) 6 5 5 5 7 30 8 0 10 1 11 2 12 4 程序填空 1 float fun float float x y x y z y z y 2 x x x 1 3 s 0 a a b 5 編程題 1 include unsigned int fun unsigned int int main unsigned int s scanf u printf u n fun s return 0 unsigned int fun unsigned int s unsigned int p 0 while s 0 p p s 10 s s 10 return p 2 include 6 include include void f1 float float float float void f2 float float float float void f3 float float float float int main float a b c d scanf f f f if a 0 printf 不是一元二次方程 n exit 0 d b b 4 a c if d 0 f1 a b c d else if d 0 f2 a b c d else f3 a b c d return 0 void f1 float a float b float c float d float x1 x2 x1 b sqrt d 2 a x2 b sqrt d 2 a printf 2f 2f n x1 x2 void f2 float a float b float c float d float x1 x2 x1 b 2 a x2 b 2 a printf 2f 2f n x1 x2 void f3 float a float b float c float d float x1 x2 x1 b 2 a x2 sqrt d 2 a printf 2f i 2f n x1 x2 printf 2f i 2f n x1 x2 3 include double p int double int main int n double x do scanf d while n 0 scanf lf printf lf n p n x return 0 double p int n double x double pn if n 0 pn 1 else if n 1 pn x else 7 pn 2 n 1 x p n 1 x n 1 p n 2 x n return pn 4 include define RATE 0 053 double fun float void display float int int main float dep int season scanf f d display dep season return 0 double fun float d return d RATE void display float d int s int i printf 季度 利 余額 n printf n for i 1 i s i printf 4d 2f 2f n i fun d fun d i d printf n 5 include double fun void int main printf lf n fun return 0 double fun void double s 0 int n 1 while double 2 n 1 2 n 2 n 1e 4 s s double 2 n 1 2 n 2 n n return s 6 include int fun int int main int w scanf d printf d n fun w return 0 int fun int w int n 1 p 1 m m w while m 10 8 m m 10 p p 10 n return w p 第 5章習(xí)題參考答案 1 選擇題 1 5 C B C BBA 6 8 DDB 2 填空題 1 0 9 2 float realArray 100 char strArray 16 int intArray 1000 3 運(yùn)算符 sizeof 4 6 字節(jié) 3 閱讀程序 寫出下面程序的運(yùn)行結(jié)果 1 aa bb cc dd 2 ab c d 3 ahAMa 4 0010 5 1 3 4 5 6 This is the title Name 1 is Rosalinda Name 2 is Zeke The biggest name alpabetically is Zeke Both names are Rosalinda Zeke 7 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 0 2 5 6 8 10 748 14 0 3 6 9 12 15 18 21 0 4 8 12 16 20 24 28 0 5 10 15 20 177 30 35 0 6 12 18 24 30 36 42 0 7 14 21 28 35 42 49 4 程序填空 1 a i j a j i 1 2 0 a i a mini maxi i a maxi a mini 3 int a int b b i a i 999 arraycopy a b b i 9 4 a sizeof ch if 5 編程題 1 include int main 1 int a 3 4 0 2 9 7 5 13 6 8 27 11 1 3 int i j temp for i 0 j 0 j 4 j temp a 2 i j a 2 i j a i j a i j temp for i 0 i 3 i for j 0 j 4 j printf 3d a i j printf n return 0 2 include int main static int a 6 6 int i j t 1 for i 0 i 6 i t i 1 for j 0 j i 1 j a i j t for i 0 i 6 i for j 0 j 6 j printf 3d a i j printf n 10 return 0 3 include define M 3 define N 4 define R 5 int main static int a M N b N R c M R int i j k 2 printf Matrix a n for i 0 i M i for j 0 j N j scanf d printf Matrix b n for i 0 i N i for j 0 j R j scanf d for i 0 i M i for j 0 j N j for k 0 k R k c i k a i j b j k for i 0 i M i for j 0 j R j printf 3d c i j printf n return 0 4 include define M 5 int main static int a M int i max 1 min 100 maxi mini temp for i 0 i M i scanf d 0 99 間的值 11 for i 0 i M i if max a i min a i mini i temp a maxi a maxi a mini a mini temp for i 0 i M i printf 3d a i return 0 3 5 include define M 3 define N 4 int main static int a M N int max 1 sumcol 0 sumrow 0 int i j maxi col for i 0 i M i sumrow 0 for j 0 j N j scanf d sumrow a i j if max 0 scanf d 12 for i 0 i M i sumcol a i col 1 printf The dth row s sum is max max d n maxi 1 max printf The dth column s sum d n col sumcol return 0 6 include define M 81 int main static char str M int i count 0 char ch gets str fflush stdin 清空輸入緩沖區(qū) 以便讀入字符數(shù)據(jù) printf Which character will be found ch getchar for i 0 i strlen str i if ch str i count printf The number of character c is d n ch count 4 return 0 7 include include define N 10 同學(xué)人數(shù) define M 5 課程數(shù) void enter scores void void sort scores int score M int average N 3 void disp scores int score M void histogram int n int score M void printchar int n static int score N M static int aver N 3 第 1 列為均值 第 2 列原始順序 第 3 列為均值逆序 int main 13 int course enter scores printf n Oringenal Score Start n disp scores score printf n Oringenal Score End n printf n Sorted Score Start n sort scores score aver printf n Sorted Score End n printf nWhich class will be statisticed n scanf d histogram course score system Pause return 0 輸入成績 void enter scores int i j for i 0 i N i for j 0 j M j scanf d aver i 0 score i j for i 0 i N i for j 1 j 3 j 5 aver i j i 成績排序 void sort scores int score M int average N 3 int i j t int temp tempindex for i 0 i N 1 i for j 0 j N 1 i j if average j 0 average j 1 0 temp average j 0 14 average j 0 average j 1 0 average j 1 0 temp tempindex average j 2 average j 2 average j 1 2 average j 1 2 tempindex printf n Score1 Score2 Score3 Score4 Score5 n for i 0 i N i t average i 2 for j 0 j M j printf 8d score t j printf n 輸出成績 void disp scores int score M int i j printf n Score1 Score2 Score3 Score4 Score5 n for i 0 i N i for j 0 j M j printf 8d score i j printf n void printchar int n 6 int i for i 0 i n i putchar void histogram int course int score M int i temp int segs 5 0 15 int sc N for i 0 i N i sc i score i course for i 0 i N i 統(tǒng)計(jì)各分段人數(shù) temp int sc i 10 segs temp 6 0 temp 5 成績 10 將成績分段 printf nSegment Number n for i 0 i 5 i 輸出直方圖 每段的人數(shù) printf 3d 5d i 1 10 50 segs i printchar segs i putchar n putchar n 8 include define M 81 int main static char str M int i count 0 char ch 0 gets str for i 0 i strlen str i if ch str i ch str i for i 0 i strlen str i if ch str i count printf max c count d n ch count return 0 7 第 6章習(xí)題參考答案 16 1 選擇題 1 5 BBDDA 6 10 CCABD 11 15 CBCDA 16 A 2 填空題 1 常量 變量 2 指針 3 2 4 12 12 5 a 0 a 3 3 閱讀程序 寫出下面程序的運(yùn)行結(jié)果 1 5 2 6 3 abcdefglkjih 4 976531 5 5 9 6 2 4 5 7 6 0 11 9 7 3 7 string a I am a teacher string b You are a student string a I am a teacher string b I am a teacher 4 程序填空 1 p 0 p 0 j 2 i strlen str j i k 1 3 a i char n 10 0 4 pk i a n i 1 pk 5 s1 s2 s1 p 5 編程題 1 include int main int a 3 b 7 c 2 int ptra int temp printf a d b d c d n a b c printf ptra d ptrb d ptrc d n ptra ptrb ptrc if ptra ptrb temp ptra ptra ptrb 17 1 ptrb temp if ptra ptrc temp ptra ptra ptrc ptrc temp if ptrb ptrc temp ptrb ptrb ptrc ptrc temp printf a d b d c d n a b c printf ptra d ptrb d ptrc d n ptra ptrb ptrc return 0 2 include include void inputdata int a int n void process int a int n void outputdata int a int n int main int a 10 n 10 inputdata a n outputdata a n process a n outputdata a n system Pause return 0 void inputdata int a int n 0 99 之間的數(shù) int i for i 0 i n i 18 scanf d a i void outputdata int ptr int n int i 2 printf n OutPut Data Start n for i 0 i n i printf 4d ptr printf n OutPut Data End n void process int ptr int n int i maxi mini int max 1 min 101 for i 0 i n i if max ptr i min ptr i mini i if mini 0 i ptr 0 ptr 0 ptr mini ptr mini i if maxi n 1 i ptr n 1 ptr n 1 ptr maxi ptr maxi i 19 if maxi 0 ptr maxi ptr mini ptr mini i 3 include 3int strLength char int main static char str 81 gets str printf string s length 3d n str strLength str system Pause return 0 int strLength char s char p s while p p return p s 4 include define M 3 define N 4 void Transpose int a N int T M int main static int a M N T N M int i j for i 0 i M i for j 0 j N j scanf d printf n Oringinal Matrix Start n for i 0 i M i 20 for j 0 j N j printf 4d a i j printf n printf n Oringinal Matrix End n Transpose a T printf n Transpose Matrix Start n for i 0 i N i for j 0 j M j printf 4d T i j printf n 4 printf n Transpose Matrix End n return 0 void Transpose int a N int T M int i j for i 0 i N i for j 0 j M j T i j a j i 5 include int main static char source 81 target 81 int result gets source gets target result Strcmp source target if result if result 0 printf s s n source target else printf s s n source target return 0 int Strcmp char s char t while s t return s t 6 include 5 define M 5 define N 3 int sum int a int main static int a M N int i j for i 0 i M i for j 0 j N j scanf d for i 0 i M i printf Row d sum 3d n i sum a i return 0 int sum int ptr int i result 0 for i 0 i N i result ptr i return result 6 22 第 7章習(xí)題答案 1 選擇題 1 5 CCDBA 6 10 CBADB 11 13 DDA 2 判斷題 1 5 6 10 第 8章習(xí)題答案 1 選擇題 1 5 CDAAD 6 8 CDB 2 填空題 1 成員域訪問運(yùn)算符 成員域間接訪問運(yùn)算符 2 4 6 0 3 enum 4 typedef 5 age q name q age 3 閱讀程序 寫出下面程序的運(yùn)行結(jié)果 1 p NULL c p next 2 p1 next p1 next p1 next 4 程序閱讀題 1 7 3 2 zhangping 20 3 Li 3 Zhang 3 Wang 2 5 編程題 include include define N 10 學(xué)生人數(shù) define M 3 課程數(shù) struct stu 定義結(jié)構(gòu)體類型 char name 15 char num 6 float score M float aver student N 說明結(jié)構(gòu)體變量 struct stu findmax struct stu student void input struct stu student 23 void output struct stu student int main struct stu temp input student output student temp findmax student printf Max is n printf 15s 8s 7 2f 7 2f 7 2f 7 2f temp name temp num 1temp score 0 temp score 1 temp score 2 temp aver M system Pause return 0 struct stu findmax struct stu student float max 0 0 int i maxi for i 0 i N i if max student i aver max student i aver maxi i return student maxi void input struct stu student int i j printf input data n for i 0 i N i scanf s s student i name student i num student i aver 0 for j 0 j M j scanf f 24 student i aver student i score j void output struct stu student int i j for i 0 i N i printf 15s 8s student i name student i num for j 0 j M j printf 7 2f student i score j printf 7 2f n student i aver M 2 第 9章 習(xí)題答案 1 選擇題 1 5 ADBBA 6 10 A CDAA 2 填空題 1 文本文件 二進(jìn)制文件 2 fopen fclose 3 fprintf fscanf feof 4 fwrite fread fputs fgets 5 文本 二進(jìn)制 6 1 0 7 字節(jié) 流式 3 程序填空題 1 fp1 fp2 ftell fp1 fgetc fp1 fp2 2 fp fp sizeof stud 0 i 0 25 char num 6 float score M float aver student N 說明結(jié)構(gòu)體變量 void sort struct stu student void writetofile struct stu student char filename char mode int main FILE fp struct stu ptr NULL int i j printf input data n for i 0 i N i scanf s s student i name student i num student i aver 0 for j 0 jname ptr num ptr aver 0 for j 0 jscore j ptr aver ptr score j if fp fopen sort2 txt a NULL printf cannot open file exit 0 26 fprintf fp s s ptr name ptr num for j 0 jscore j fprintf fp 7 2f n ptr aver M fclose fp return 0 void sort struct stu student struct stu temp int i j k for i 0 i N 1 i k i for j i 1 j N j if student j aver student k aver k j if k i temp student i student i student k student k temp 2void writetofile struct stu student char filename char mode FILE fp int i j if fp fopen filename mode NULL printf cannot open file exit 0 for i 0 i N i fprintf fp s s student i name student i num for j 0 j M j fprintf fp 7 2f student i score j fprintf fp 7 2f n student i aver M 27 fclose fp

注意事項(xiàng)

本文(C語言程序設(shè)計(jì)教程-李含光-鄭關(guān)勝-清華大學(xué)出版社習(xí)題答案習(xí)題答案[完美打印版])為本站會(huì)員(gbs****77)主動(dòng)上傳,裝配圖網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)上載內(nèi)容本身不做任何修改或編輯。 若此文所含內(nèi)容侵犯了您的版權(quán)或隱私,請(qǐng)立即通知裝配圖網(wǎng)(點(diǎn)擊聯(lián)系客服),我們立即給予刪除!

溫馨提示:如果因?yàn)榫W(wǎng)速或其他原因下載失敗請(qǐng)重新下載,重復(fù)下載不扣分。




關(guān)于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

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

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


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