欢迎来到天天文库
浏览记录
ID:59421488
大小:268.00 KB
页数:60页
时间:2020-09-19
《C语言程序设计现代方法课件.ppt》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、Chapter5SelectionStatements1Copyright©2008W.W.Norton&Company.Allrightsreserved.StatementsSofar,we’veusedreturnstatementsandexpressionstatements.MostofC’sremainingstatementsfallintothreecategories:Selectionstatements:ifandswitchIterationstatements:while,do,andforJumpstatements:break
2、,continue,andgoto.(returnalsobelongsinthiscategory.)OtherCstatements:CompoundstatementNullstatementCopyright©2008W.W.Norton&Company.Allrightsreserved.2LogicalExpressionsSeveralofC’sstatementsmusttestthevalueofanexpressiontoseeifitis“true”or“false.”Forexample,anifstatementmightneedt
3、otesttheexpressioni4、atorsC’srelationaloperators:greaterthan<=lessthanorequalto>=greaterthanorequaltoTheseoperatorsproduce0(false)or1(true)whenusedinexpressions.Therelationaloperatorscanbeusedtocompareintegersandfloating-pointnumbers,withoperandsofmixedtypesallowed.Copyright©2008W.W.Norton&Co5、mpany.Allrightsreserved.4RelationalOperatorsTheprecedenceoftherelationaloperatorsislowerthanthatofthearithmeticoperators.Forexample,i+j6、7、rators:==equalto!=notequaltoTheequalityoperatorsareleftassociativeandproduceeither0(false)or1(true)astheirresult.Theequalityoperatorshavelowerprecedencethantherelationaloperators,sotheexpressioni8、gicalOperatorsMorecomplica
4、atorsC’srelationaloperators:greaterthan<=lessthanorequalto>=greaterthanorequaltoTheseoperatorsproduce0(false)or1(true)whenusedinexpressions.Therelationaloperatorscanbeusedtocompareintegersandfloating-pointnumbers,withoperandsofmixedtypesallowed.Copyright©2008W.W.Norton&Co
5、mpany.Allrightsreserved.4RelationalOperatorsTheprecedenceoftherelationaloperatorsislowerthanthatofthearithmeticoperators.Forexample,i+j6、7、rators:==equalto!=notequaltoTheequalityoperatorsareleftassociativeandproduceeither0(false)or1(true)astheirresult.Theequalityoperatorshavelowerprecedencethantherelationaloperators,sotheexpressioni8、gicalOperatorsMorecomplica
6、7、rators:==equalto!=notequaltoTheequalityoperatorsareleftassociativeandproduceeither0(false)or1(true)astheirresult.Theequalityoperatorshavelowerprecedencethantherelationaloperators,sotheexpressioni8、gicalOperatorsMorecomplica
7、rators:==equalto!=notequaltoTheequalityoperatorsareleftassociativeandproduceeither0(false)or1(true)astheirresult.Theequalityoperatorshavelowerprecedencethantherelationaloperators,sotheexpressioni8、gicalOperatorsMorecomplica
8、gicalOperatorsMorecomplica
此文档下载收益归作者所有