本書是基于“新工科”背景應用型工程教育中人才培養(yǎng)模式要求編寫而成的,從計算思維視角探索程序設(shè)計的過程和目標,其中設(shè)計的每個案例代表性都很強。本書共 12 章,內(nèi)容包括引論、數(shù)據(jù)類型、運算符與表達式、輸入與輸出、順序結(jié)構(gòu)程序設(shè)計與執(zhí)行、分支結(jié)構(gòu)程序設(shè)計與執(zhí)行、循環(huán)結(jié)構(gòu)程序設(shè)計與執(zhí)行、指針的定義與引用、數(shù)組與指針、模塊化程序設(shè)計、結(jié)構(gòu)體與鏈表、文件操作。本書既適合信息類相關(guān)人員了解程序設(shè)計與計算思維所用,又適合為非信息類相關(guān)人員提供信息理論與技術(shù)幫助。
劉正余,副教授,皖西學院電子與信息工程學院計算機基礎(chǔ)教研室主任,主要方向為計算機應用、算法優(yōu)化、數(shù)據(jù)挖掘。
第 1 章 引論····································1
案例 1:設(shè)計加法表 ·····················1
Prog1.1 ································1
Prog1.2 ································2
Prog1.3 ································3
Prog1.4 ································4
Prog1.5 ································5
案例 2:一組數(shù)據(jù)的“逆序”輸出 ···5
Prog2.1 ································5
Prog2.2 ································6
Prog2.3 ································7
Prog2.4 ································7
Prog2.5 ································8
Prog2.6 ································9
第 2 章 數(shù)據(jù)類型 ··························.10
案例 3:求兩個數(shù)的和 ···············.10
Prog3.1 ·····························.10
Prog3.2 ·····························.10
案例 4:整型數(shù)據(jù) ·····················.11
Prog4.1 ·····························.11
Prog4.2 ·····························.12
Prog4.3 ·····························.12
Prog4.4 ·····························.13
案例 5:實型數(shù)據(jù) ·····················.15
Prog5.1 ·····························.15
Prog5.2 ·····························.15
Prog5.3 ·····························.16
Prog5.4 ·····························.17
案例 6:字符型數(shù)據(jù) ··················.17
Prog6.1 ·····························.17
Prog6.2 ·····························.18
Prog6.3 ·····························.18
Prog6.4 ·····························.19
Prog6.5 ·····························.20
Prog6.6 ·····························.21
Prog6.7 ·····························.21
第 3 章 運算符與表達式 ·················.23
案例 7:算術(shù)運算符與表達式······.23
Prog7.1 ·····························.23
Prog7.2 ·····························.23
Prog7.3 ·····························.24
Prog7.4 ·····························.25
案例 8:關(guān)系運算符與表達式······.26
Prog8.1 ·····························.26
案例 9:邏輯運算符與表達式······.27
Prog9.1 ·····························.27
Prog9.2 ·····························.28
Prog9.3 ·····························.28
Prog9.4 ·····························.29
案例 10:賦值運算符與表達式·····.30
Prog10.1 ····························.30
案例 11:逗號運算符與表達式·····.31
Prog11.1 ····························.31
第 4 章 輸入與輸出 ·······················.32
案例 12:整型數(shù)據(jù)輸入··············.32
Prog12.1 ····························.32
案例 13:實型數(shù)據(jù)輸入··············.33
Prog13.1 ····························.33
案例 14:字符型數(shù)據(jù)輸入···········.34
Prog14.1 ····························.34
案例 15:數(shù)值型數(shù)據(jù)與字符型
數(shù)據(jù)混合輸入··············.35
Prog15.1 ····························.35
案例 16:整型數(shù)據(jù)輸出··············.36
Prog16.1 ····························.36
案例 17:實型數(shù)據(jù)輸出··············.37
Prog17.1 ····························.37
案例 18:字符型數(shù)據(jù)輸出···········.38
Prog18.1 ····························.38
案例 19:文件數(shù)據(jù)寫入和讀出·····.39
Prog19.1 ····························.39
第 5 章 順序結(jié)構(gòu)程序設(shè)計與執(zhí)行 ·····.42
案例 20:順序結(jié)構(gòu)程序設(shè)計
與執(zhí)行·······················.42
Prog20.1 ····························.42
案例 21:數(shù)據(jù)的交換·················.42
Prog21.1 ····························.42
Prog21.2 ····························.43
Prog21.3 ····························.44
Prog21.4 ····························.46
案例 22:四舍五入····················.48
Prog22.1 ····························.48
第 6 章 分支結(jié)構(gòu)程序設(shè)計與執(zhí)行 ·····.50
案例 23:分支結(jié)構(gòu)程序設(shè)計
與執(zhí)行·······················.50
Prog23.1 ····························.50
Prog23.2 ····························.51
Prog23.3 ····························.51
Prog23.4 ····························.54
案例 24:求數(shù)據(jù)的極值··············.56
Prog24.1 ····························.56
Prog24.2 ····························.57
案例 25:簡單數(shù)據(jù)排序··············.59
Prog25.1 ····························.59
Prog25.2 ····························.60
案例 26:分段函數(shù)求解··············.61
Prog26.1 ····························.61
Prog26.2 ····························.62
Prog26.3 ····························.63
Prog26.4 ····························.64
案例 27:開關(guān)語句程序設(shè)計與
執(zhí)行··························.65
Prog27.1 ····························.65
案例 28:學生成績分析與設(shè)計·····.66
Prog28.1 ····························.66
案例 29:簡易菜單設(shè)計··············.67
Prog29.1 ····························.67
第 7 章 循環(huán)結(jié)構(gòu)程序設(shè)計與執(zhí)行 ·····.69
案例 30:循環(huán)結(jié)構(gòu)程序設(shè)計
與執(zhí)行·······················.69
Prog30.1 ····························.69
Prog30.2 ····························.70
Prog30.3 ····························.71
案例 31:順序結(jié)構(gòu)與循環(huán)結(jié)構(gòu) ····.72
Prog31.1 ····························.72
案例 32:多重(嵌套)循環(huán)結(jié)構(gòu)
程序設(shè)計與執(zhí)行···········.73
Prog32.1 ····························.73
案例 33:求和問題····················.74
Prog33.1 ····························.74
Prog33.2 ·········P