当前位置: 首页 > news >正文

建站系统下载黑马程序员培训机构

建站系统下载,黑马程序员培训机构,网站必须做商标么,网络舆情监测与预警系统通过对海量C中的运算符总结#xff08;4#xff09;#xff1a;逻辑运算符#xff08;下#xff09; 以下程序演示了如何使用条件语句和逻辑运算符根据变量的值执行不同的代码行#xff1a; #include iostream using namespace std;int main() {cout Use …C中的运算符总结4逻辑运算符下 以下程序演示了如何使用条件语句和逻辑运算符根据变量的值执行不同的代码行 #include iostream using namespace std;int main() {cout Use boolean values(0 / 1) to answer the questions endl;cout Is it raining? ;bool isRaining false;cin isRaining;cout Do you have buses on the streets? ;bool busesPly false;cin busesPly;// Conditional statement uses logical AND and NOTif (isRaining !busesPly)cout You cannot go to work endl;elsecout You can go to work endl;if (isRaining busesPly)cout Take an umbrella endl;if ((!isRaining) busesPly)cout Enjoy the sun and have a nice day endl;return 0; }输出 Use boolean values(0 / 1) to answer the questions Is it raining? 1 Do you have buses on the streets? 1 You can go to work Take an umbrella再次运行的输出 Use boolean values(0 / 1) to answer the questions Is it raining? 1 Do you have buses on the streets? 0 You cannot go to work最后一次运行的输出 Use boolean values(0 / 1) to answer the questions Is it raining? 0 Do you have buses on the streets? 1 You can go to work Enjoy the sun and have a nice day第 15 行包含条件表达式 (isRaining !busesPly)可将其读作 “下雨且没有公交车”。这个表达式使用了逻辑 AND 运算符将没有公交车对有公交车执行逻辑 NOT 运算和下雨关联起来。 以下程序演示了如何将逻辑运算符 NOT 和 OR ! 和 ||用于条件处理。 #include iostream using namespace std;int main() {cout Answer questions with 0 or 1 endl;cout Is there a discount on your favorite car? ;bool onDiscount false;cin onDiscount;cout Did you get a fantastic bonus? ;bool fantasticBonus false;cin fantasticBonus;if (onDiscount || fantasticBonus)cout Congratulations, you can buy that car! endl;elsecout Sorry, waiting a while is a good idea endl;if (!onDiscount)cout Car not on discount endl;return 0; }输出 Answer questions with 0 or 1 Is there a discount on your favorite car? 0 Did you get a fantastic bonus? 1 Congratulations, you can buy that car! Car not on discount再次运行的输出 Answer questions with 0 or 1 Is there a discount on your favorite car? 0 Did you get a fantastic bonus? 0 Sorry, waiting a while is a good idea Car not on discount最后一次运行的输出 Answer questions with 0 or 1 Is there a discount on your favorite car? 1 Did you get a fantastic bonus? 1 Congratulations, you can buy that car! 分析 这个程序建议您能够打折或得到很高的补贴时就把车买了不然就再观望观望。它还在第 19 行使用了逻辑非运算来提醒您不打折。第 14 行使用了一条 if 语句而第 16 行是与之配套的 else 语句。在条件 (onDiscount || fantasticBonus) 为 true 时将执行第 15 行的语句。这个表达式包含逻辑运算符||仅当您喜欢的汽车打折或能够获得很高的补贴时 该表达式才为 true。当该表达式为 false 时 将执行 else语句后面的语句第 17 行。 该文章会更新欢迎大家批评指正。 推荐一个零声学院免费公开课程个人觉得老师讲得不错 分享给大家LinuxNginxZeroMQMySQLRedis fastdfsMongoDBZK流媒体CDNP2PK8SDocker TCP/IP协程DPDK等技术内容点击立即学习: 服务器课程C服务器 学习链接
http://www.dnsts.com.cn/news/94310.html

相关文章:

  • wordpress站内信如何创建一个简单的网页
  • 河南自助建站seo公司国内新闻最新消息摘抄
  • 小说网站收录了怎么做排名常州建设局官方网站
  • 找个免费的网站厦门做网站优化价格
  • 网站seo怎么做深圳品牌女装品牌大全
  • 江苏 建设 招标有限公司网站三合一网站建设口碑好
  • 做网站大图片临沧网站建设公司
  • 英语网站建设费用access做网站数据方法
  • 南宁网站建设方案报价顺口好记的公司名字
  • 开彩票网站做私庄wordpress地址重改
  • 西安在线网站制作网站用户体验比较
  • 深圳好看的公司网站oppo开发者选项在哪里打开
  • 网站开发需要什么专业的人才网站刷新代码
  • 网站游戏怎么制作阳明拍卖公司网站
  • 北京网站的优化哪个公司的装饰设计公司
  • 网站建设企业建站wordpress页面更新发布失败
  • 学校网站html模板宿迁网站建设推广公司
  • 公司网站销售平台建设费分录wordpress mu
  • wordpress手机端网站模板下载失败蒙牛网站是谁做的
  • dedecms网站地图修改南通市 网站设计
  • 成都市建设领域网站咨询电话宁波seo搜索引擎优化
  • 网站开发商标属于哪一类雷锋书签制作图片
  • 30天网站建设实录视频云盘icons
  • 有手机网站怎样做微信小程序大连住房城乡建设网站
  • 网站关闭与域名备案网页设计模板图片家乡
  • 防伪网站怎么做建立问答类的网站
  • 介绍美食的网站模板免费下载网络营销公司都做什么的
  • vs做网站开发育婴师培训
  • 个人建设网站需要什么证件吗jquery网站源码
  • 石龙镇住房规划建设局网站北京建站模板展示