




已閱讀5頁,還剩2頁未讀, 繼續(xù)免費閱讀
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1 第 5 章習題參考答案 1 選擇題 選擇題 1 C 2 B C 3 B 4 B 5 A 6 D 7 D 8 B 2 填空題 填空題 1 0 9 2 float realArray 100 char strArray 16 int intArray 1000 3 運算符 sizeof 4 6 字節(jié) 3 閱讀程序 寫出下面程序的運行結果 閱讀程序 寫出下面程序的運行結果 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 4 a sizeof ch if 5 編程題 編程題 1 include int main 2 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 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 3 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 間的值 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 4 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 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ū) 以便讀入字符數據 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 5 return 0 7 include include define N 10 同學人數 define M 5 課程數 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 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 6 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 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 7 int i for i 0 i n i putchar void histogram int course int score M int i temp int segs 5 0 int sc N for i 0 i N i sc i score i course for i 0 i N i 統(tǒng)計各分段人數 temp int sc i 10 segs temp 6 0 temp 5 成績 10 將成績分段 printf nSegment Number n for i 0 i 5 i 輸出直方圖 每段的人數 printf 3d 5d i 1 10 50 segs i printchar segs i putchar n putchar n 8 include de
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 推進綠色發(fā)展助力經開區(qū)可持續(xù)發(fā)展
- 多元化發(fā)展:出版業(yè)跨界創(chuàng)新的新機遇
- 健美操教育體系改革與創(chuàng)新思考
- 抽水蓄能產業(yè)高質量發(fā)展經濟效益和社會效益
- 智能工業(yè)機械之路
- 游戲領軍創(chuàng)新驅動
- 四年級英語全攻略
- 2025物流運輸業(yè)務租賃合同
- 傳統(tǒng)康復技術
- 2025至2030年中國雙層憑證行業(yè)投資前景及策略咨詢報告
- 《中華人民共和國藥典》修訂內容(2025年)解讀課件
- 2025至2030中國高效染料敏化太陽能電池市場深度調查與前景預測研究報告
- GB 10769-2025食品安全國家標準嬰幼兒谷類輔助食品
- 遼寧2025年三支一扶考試真題
- 人工智能在單片機教學中的應用與創(chuàng)新
- 歷史教學新視角:學科核心素養(yǎng)“歷史解釋”實施策略
- 井下作業(yè)施工方案
- 2025年小學一年級語文考試趣味試題及答案
- 社會科學領域課題研究報告范文
- 成人膿毒癥患者醫(yī)學營養(yǎng)治療指南(2025版)
- 生物工程細胞培養(yǎng)技術試題
評論
0/150
提交評論