C语言程序设计第五章课件.ppt

上传人:豆**** 文档编号:34119961 上传时间:2022-08-13 格式:PPT 页数:57 大小:946.50KB
返回 下载 相关 举报
C语言程序设计第五章课件.ppt_第1页
第1页 / 共57页
C语言程序设计第五章课件.ppt_第2页
第2页 / 共57页
点击查看更多>>
资源描述

《C语言程序设计第五章课件.ppt》由会员分享,可在线阅读,更多相关《C语言程序设计第五章课件.ppt(57页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、2022-8-132/562022-8-133/562022-8-134/562022-8-135/562022-8-136/562022-8-137/562022-8-138/562022-8-139/562022-8-1310/562022-8-1311/562022-8-1312/56Start/EndProcessInput/OutputTestConnectorFlow of activities2022-8-1313/56 2022-8-1314/56ABC2022-8-1315/56 2022-8-1316/562022-8-1317/56Relational Operation

2、DescriptionExamples of ExpressionValueLess than6 91 (true)=Less than or equal to5 Greater than2 60 (false)=Greater than or equal to9 = 51 (true)=Equal to7 = 50 (false)!=Not equal to6 != 51 (true)2022-8-1318/56step aif startstep mstep nend_ifstep b2022-8-1319/56Syntax:复合语句复合语句compound statement被当做一条语

3、句看待被当做一条语句看待2022-8-1320/56Syntax:2022-8-1321/56#include main() int a, b, max; printf(Input a,b:); scanf(%d,%d, &a, &b); if (a b)max = a; if (a = b)max = b; printf(max = %dn, max);Input a,b: _Input a,b: 20 15_Input a,b: 20 15max = 20_2022-8-1322/56Step aif startStep mStep nend_ifelse startStep xStep

4、yend_elseStep z2022-8-1323/56Syntax:or2022-8-1324/562022-8-1325/562022-8-1326/56#include main() int a, b, max; printf(Input a, b:); scanf(%d,%d, &a, &b); if (a b) max = a; else max = b; printf(max = %d, max); if (a b) max = a; if (a = b) max = b;2022-8-1327/56#include main() int a, b, max; printf(In

5、put a, b:); scanf(%d,%d, &a, &b); if (a b) max = a; else max = b; printf(max = %d, max); max = a b ? a : b;2022-8-1328/56Step a (expression1)Step m (expression2) Step n Step z2022-8-1329/56Step a(expression1) Step m (expression2) Step n Step x Step z2022-8-1330/56The structure is similar to multiple

6、 selection (flowchart)2022-8-1331/56Important Rule !2022-8-1332/56Example: switch (month) case 1:printf(Januaryn);break;case 2:printf(Februaryn);break;case 3:printf(Marchn);break;default:printf(Othersn);break; printf(End);January_JanuaryEnd _2022-8-1333/56Example: switch (month) case 1:printf(Januar

7、yn);break;case 2:printf(Februaryn);break;case 3:printf(Marchn);break;default:printf(Othersn);break; printf(End);March_MarchEnd _2022-8-1334/56Example: switch (month) case 1:printf(Januaryn);break;case 2:printf(Februaryn);break;case 3:printf(Marchn);break;default:printf(Othersn);break; printf(End);20

8、22-8-1335/56Example: switch (month) case 1:printf(Januaryn);break;case 2:printf(Februaryn);case 3:printf(Marchn);break;default:printf(Othersn);break; printf(End);2022-8-1336/56Example: switch (month) case 1:printf(Januaryn);break;case 2:printf(Februaryn);case 3:printf(Marchn);break;default:printf(Ot

9、hersn);break; printf(End);February_March _End _2022-8-1337/56Example: switch (month) case 1:printf(Januaryn);break;case 2:printf(Februaryn);case 3:printf(Marchn);break;default:printf(Othersn);break; printf(End);最好不省略最好不省略!2022-8-1338/562022-8-1339/56Why?注释掉会怎样注释掉会怎样? ?2022-8-1340/562022-8-1341/56空格空

10、格2022-8-1342/562022-8-1343/56取绝对值函数取绝对值函数2022-8-1344/56aba & b a | b!a!b0000110101101001011111002022-8-1345/562022-8-1346/56Example: (a = 1) & (b+ = 5) a0b5c15d17尽量使用最少的操作数来确定表达式的值,这就尽量使用最少的操作数来确定表达式的值,这就意味着表达式中的某些操作数可能不会被计算意味着表达式中的某些操作数可能不会被计算2022-8-1347/562022-8-1348/562022-8-1349/56通常结合使用选择有限数量的重要路径进行通常结合使用选择有限数量的重要路径进行白盒测试,对重要的功能需求进行黑盒测试白盒测试,对重要的功能需求进行黑盒测试2022-8-1350/56错在哪里?错在哪里?2022-8-1351/562022-8-1352/562022-8-1353/56错在哪里?错在哪里?2022-8-1354/562022-8-1355/56等腰在先等腰在先等边在后等边在后是否可以是否可以? ?2022-8-1356/56

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 教案示例

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁