C程序设计主讲刘怀亮:完美解析选择结构实例程序【PPT】

1 下载量 82 浏览量 更新于2024-04-11 收藏 463KB PPT 举报
The C language program design presentation titled "C语言程序设计No第章程序设计完美版资料.ppt" discusses the concept of program design in C programming. The fifth lecture, presented by Liu Huailiang from the Information Management Department of the School of Economics and Management, introduces the topic of selection structures in C program design. The lecture begins with an example that involves calculating the value of the function sin(x)/x where x is not equal to zero and y is equal to 1 when x equals zero. The necessary steps for this calculation are outlined, including inputting the value of x, determining the value of x, calculating the value of y based on x, and finally outputting the value of y. It is pointed out that the use of only sequential structures cannot achieve this calculation, and thus the introduction of selection structures becomes necessary. The sample code provided includes the necessary header files and defines a main function that prompts the user to input the value of x, reads the input, carries out the required calculations, and outputs the value of y. In conclusion, the lecture emphasizes the importance of selection structures in C program design for scenarios that involve making decisions based on certain conditions. The example provided serves as a practical illustration of how selection structures can be used to solve problems in program design. The presentation serves as a valuable resource for those interested in mastering C programming and improving their program design skills.