C程序设计ch04判定分支和循环.pptVIP

  • 6
  • 0
  • 约1.55万字
  • 约 69页
  • 2016-09-23 发布于重庆
  • 举报
C程序设计ch04判定分支和循环.ppt

三种基本结构 顺序结构 条件运算符与表达式 一般形式: expr1 ? expr2 : expr3 执行过程 功能:相当于条件语句,但不能取代一般if语句 例 百分制成绩转换为五级制 p122 80 to 100 Honours 60 to 79 First Division 50 to 59 Second Division 40 to 49 Third Division 0 to 39 Fail 例 累进电费 p124 例 根据收入计算应缴个税 if ~ else 配对原则:缺省{ }时,else总是和它上面离它最近的未配对的if配对 例pp136 Pay-Bill Calculations: Read an executives job number, level number, and basic pay and then computer the net salary after withholding income tax. The problem is detailed in the program. “温故”逗号运算符 p154 下面这个例子既是循环语句的应用,也比较充分体现计算机的强大的逻辑运算能力

文档评论(0)

1亿VIP精品文档

相关文档