本教材共分兩個部分,第一部分主要介紹C語言程序設(shè)計實驗的基本目的與要求,以及計算機程序設(shè)計的基本過程;第二部分包含14個實驗,主要訓(xùn)練學(xué)生基本編程技能; 每個實驗由實驗?zāi)康摹㈩A(yù)備知識、實例解析、實驗內(nèi)容四部分組成,其中:"實驗?zāi)康摹睂W(xué)生提出本次實驗的預(yù)期目標(biāo);"預(yù)備知識”幫助學(xué)生總結(jié)本次實驗所需的理論知識;"實例解析”通過精心選擇的例題向?qū)W生講解如何應(yīng)用相關(guān)知識解決具體問題,以更好地幫助學(xué)生進(jìn)行實驗準(zhǔn)備工作;"實驗內(nèi)容”除了提供傳統(tǒng)的編程題目供學(xué)生練習(xí)外,還提供程序分析題、程序改錯題、程序測試題、程序填空題等多種類型的題目,讓學(xué)生進(jìn)行全方位的編程實踐,從而幫助學(xué)生更好地理解程序設(shè)計的方法。 本書可以作為各類高等院校C語言程序設(shè)計課程的實驗教材,也可以作為廣大編程愛好者學(xué)習(xí)C語言程序設(shè)計的參考書。
馬楊琿,女,主持或參與科研項目多項,其中。作為主要人員參與"VB程序設(shè)計”院優(yōu)秀課程和浙江省高校"國家精品課程”建設(shè)工作,參與"C語言程序設(shè)計”、"大學(xué)生基本技能”"Python基礎(chǔ)”院重點建設(shè)課程建設(shè)。
第一部分 C 語言程序設(shè)計實驗概述
第1 章 C 語言程序設(shè)計實驗的目的與要求 ·························································.2
1.1 C 語言程序設(shè)計實驗的目的 ····························································.2
1.2 C 語言程序設(shè)計實驗的要求 ····························································.3
第2 章 C 語言程序設(shè)計的基本過程 ··································································.4
2.1 問題的描述與分析 ········································································.4
2.2 算法的設(shè)計與表示 ········································································.4
2.3 程序的編寫與測試 ········································································.5
2.4 計算思維的培養(yǎng)與訓(xùn)練 ··································································.6
第二部分 C 語言程序設(shè)計實驗
實驗1 運行一個簡單的C 語言程序 ··································································.8
一、實驗?zāi)康?·····················································································.8
二、預(yù)備知識 ·····················································································.8
三、實例解析 ·····················································································.9
四、實驗內(nèi)容 ···················································································.13
實驗2 順序結(jié)構(gòu)程序設(shè)計 ·············································································.15
一、實驗?zāi)康?···················································································.15
二、預(yù)備知識 ···················································································.15
三、實例解析 ···················································································.17
四、實驗內(nèi)容 ···················································································.19
實驗3 選擇結(jié)構(gòu)程序設(shè)計 ·············································································.23
一、實驗?zāi)康?···················································································.23
二、預(yù)備知識 ···················································································.23
三、實例解析 ···················································································.25
四、實驗內(nèi)容 ···················································································.29
實驗4 循環(huán)結(jié)構(gòu)程序設(shè)計 ·············································································.32
一、實驗?zāi)康?···················································································.32
二、預(yù)備知識 ···················································································.32
三、實例解析 ···················································································.34
四、實驗內(nèi)容 ···················································································.39
實驗5 一維數(shù)組及應(yīng)用 ················································································.42
一、實驗?zāi)康?···················································································.42
二、預(yù)備知識 ···················································································.42
三、實例解析 ···················································································.45
四、實驗內(nèi)容 ···················································································.53
實驗6 二維數(shù)組及應(yīng)用 ················································································.58
一、實驗?zāi)康?···················································································.58
二、預(yù)備知識 ···················································································.58
三、實例解析 ···················································································.59
四、實驗內(nèi)容 ···················································································.65
實驗7 字符串應(yīng)用 ······················································································.69
一、實驗?zāi)康?···················································································.69
二、預(yù)備知識 ···················································································.69
三、實例解析 ···················································································.70
四、實驗內(nèi)容 ···················································································.74
實驗8 指針應(yīng)用 ·························································································.78
一、實驗?zāi)康?···················································································.78
二、預(yù)備知識 ···················································································.78
三、實例解析 ···················································································.81
四、實驗內(nèi)容 ···················································································.84
實驗9 函數(shù)應(yīng)用 ·························································································.88
一、實驗?zāi)康?···················································································.88
二、預(yù)備知識 ···················································································.88
三、實例解析 ···················································································.90
四、實驗內(nèi)容 ···················································································.98
實驗10 結(jié)構(gòu)體 ··························································································.104
一、實驗?zāi)康?··················································································.104
二、預(yù)備知識 ··················································································.104
三、實例解析 ··················································································.106
四、實驗內(nèi)容 ··················································································.113
實驗11 鏈表操作 ·······················································································.119
一、實驗?zāi)康?··················································································.119
二、預(yù)備知識 ··················································································.119
三、實例解析 ··················································································.121
四、實驗內(nèi)容 ··················································································.128
實驗12 文件及應(yīng)用 ····················································································.133
一、實驗?zāi)康?··················································································.133
二、預(yù)備知識 ··················································································.133
三、實例解析 ··················································································.137
四、實驗內(nèi)容 ··················································································.144
實驗13 簡單C++程序設(shè)計 ··········································································.147
一、實驗?zāi)康?··················································································.147
二、預(yù)備知識 ··················································································.147
三、實例解析 ··················································································.149
四、實驗內(nèi)容 ··················································································.154
實驗14 綜合應(yīng)用 ·······················································································.156
一、實驗?zāi)康?··················································································.156
二、預(yù)備知識 ··················································································.156
三、實例解析 ··················································································.157
四、實驗內(nèi)容 ··················································································.170
附 錄
附錄A ASCII 碼字符集 ···············································································.174
附錄B C 語言中的關(guān)鍵字 ············································································.175
附錄C 運算符優(yōu)先級與結(jié)合性 ······································································.176
附錄D 常用庫函數(shù) ·····················································································.177
附錄E Dev-C++環(huán)境下的程序調(diào)試方法 ··························································.181