本教材共分两个部分,第一部分主要介绍C语言程序设计实验的基本目的与要求,以及计算机程序设计的基本过程;第二部分包含14个实验,主要训练学生基本编程技能; 每个实验由实验目的、预备知识、实例解析、实验内容四部分组成,其中:"实验目的”对学生提出本次实验的预期目标;"预备知识”帮助学生总结本次实验所需的理论知识;"实例解析”通过精心选择的例题向学生讲解如何应用相关知识解决具体问题,以更好地帮助学生进行实验准备工作;"实验内容”除了提供传统的编程题目供学生练习外,还提供程序分析题、程序改错题、程序测试题、程序填空题等多种类型的题目,让学生进行全方位的编程实践,从而帮助学生更好地理解程序设计的方法。 本书可以作为各类高等院校C语言程序设计课程的实验教材,也可以作为广大编程爱好者学习C语言程序设计的参考书。
马杨珲,女,主持或参与科研项目多项,其中。作为主要人员参与"VB程序设计”院优秀课程和浙江省高校"国家精品课程”建设工作,参与"C语言程序设计”、"大学生基本技能”"Python基础”院重点建设课程建设。
第一部分 C 语言程序设计实验概述
第1 章 C 语言程序设计实验的目的与要求 ·························································.2
1.1 C 语言程序设计实验的目的 ····························································.2
1.2 C 语言程序设计实验的要求 ····························································.3
第2 章 C 语言程序设计的基本过程 ··································································.4
2.1 问题的描述与分析 ········································································.4
2.2 算法的设计与表示 ········································································.4
2.3 程序的编写与测试 ········································································.5
2.4 计算思维的培养与训练 ··································································.6
第二部分 C 语言程序设计实验
实验1 运行一个简单的C 语言程序 ··································································.8
一、实验目的 ·····················································································.8
二、预备知识 ·····················································································.8
三、实例解析 ·····················································································.9
四、实验内容 ···················································································.13
实验2 顺序结构程序设计 ·············································································.15
一、实验目的 ···················································································.15
二、预备知识 ···················································································.15
三、实例解析 ···················································································.17
四、实验内容 ···················································································.19
实验3 选择结构程序设计 ·············································································.23
一、实验目的 ···················································································.23
二、预备知识 ···················································································.23
三、实例解析 ···················································································.25
四、实验内容 ···················································································.29
实验4 循环结构程序设计 ·············································································.32
一、实验目的 ···················································································.32
二、预备知识 ···················································································.32
三、实例解析 ···················································································.34
四、实验内容 ···················································································.39
实验5 一维数组及应用 ················································································.42
一、实验目的 ···················································································.42
二、预备知识 ···················································································.42
三、实例解析 ···················································································.45
四、实验内容 ···················································································.53
实验6 二维数组及应用 ················································································.58
一、实验目的 ···················································································.58
二、预备知识 ···················································································.58
三、实例解析 ···················································································.59
四、实验内容 ···················································································.65
实验7 字符串应用 ······················································································.69
一、实验目的 ···················································································.69
二、预备知识 ···················································································.69
三、实例解析 ···················································································.70
四、实验内容 ···················································································.74
实验8 指针应用 ·························································································.78
一、实验目的 ···················································································.78
二、预备知识 ···················································································.78
三、实例解析 ···················································································.81
四、实验内容 ···················································································.84
实验9 函数应用 ·························································································.88
一、实验目的 ···················································································.88
二、预备知识 ···················································································.88
三、实例解析 ···················································································.90
四、实验内容 ···················································································.98
实验10 结构体 ··························································································.104
一、实验目的 ··················································································.104
二、预备知识 ··················································································.104
三、实例解析 ··················································································.106
四、实验内容 ··················································································.113
实验11 链表操作 ·······················································································.119
一、实验目的 ··················································································.119
二、预备知识 ··················································································.119
三、实例解析 ··················································································.121
四、实验内容 ··················································································.128
实验12 文件及应用 ····················································································.133
一、实验目的 ··················································································.133
二、预备知识 ··················································································.133
三、实例解析 ··················································································.137
四、实验内容 ··················································································.144
实验13 简单C++程序设计 ··········································································.147
一、实验目的 ··················································································.147
二、预备知识 ··················································································.147
三、实例解析 ··················································································.149
四、实验内容 ··················································································.154
实验14 综合应用 ·······················································································.156
一、实验目的 ··················································································.156
二、预备知识 ··················································································.156
三、实例解析 ··················································································.157
四、实验内容 ··················································································.170
附 录
附录A ASCII 码字符集 ···············································································.174
附录B C 语言中的关键字 ············································································.175
附录C 运算符优先级与结合性 ······································································.176
附录D 常用库函数 ·····················································································.177
附录E Dev-C++环境下的程序调试方法 ··························································.181