c++程序—选择结构
- if(判断条件){执行语句}
#include<iostream>
using namespace std;
#include<string> int main()
{
int score = ;
cout << "Input your score,please :" << endl;
cin >> score;
cout << "Your score is " << score << endl;
if (score >= )
{
cout << "You will own a good school!" << endl;
} system("pause");
return ; }
- if...else
#include<iostream>
using namespace std;
#include<string> int main()
{
int score = ;
cout << "Input your score,please :" << endl;
cin >> score;
cout << "Your score is " << score << endl;
if (score >= )
cout << "You will own a good school!" << endl;
else
cout << "see you next year" << endl; system("pause");
return ; }
- 多种选择
#include<iostream>
using namespace std;
#include<string> int main()
{
float score = ;
cout << "Input students' score(0 to 100),please :" << endl;
cin >> score;
cout << "score is " << score << endl;
if (score >= )
cout << "The student' score is A" << endl;
else if(score>=)
cout << "The student' score is B" << endl;
else if (score >= )
cout << "The student' score is C" << endl;
else
cout << "The student' score is D" << endl; system("pause");
return ; }
c++程序—选择结构的更多相关文章
- 程序选择结构if和switch的定义以及使用方法
什么是if选择结构 if选择结构是根据条件判断之后在做处理 基本的if选择结构的语法 if(条件){//条件为真则执行代码1,否则不执行 //代码块1 } if-else选择结构 为什么使 ...
- 黑马程序员——JAVA基础之程序控制流结构之判断结构,选择结构
------- android培训.java培训.期待与您交流! ---------- 程序控制流结构:顺序结构:判断结构:选择结构:循环结构. 判断结构:条件表达式无论写成什么样子,只看最终的结构是 ...
- 第三章 C#程序结构[3.2 选择结构的应用(Windows窗体应用程序)(四)]
[案例]设计一个顾客选购商品的系统.其中,顾客身份有两类,一类是VIP,另一类是普通会员:商品种类有3种.分别是上衣.裤子和鞋子.其中,VIP享受8折优惠和商店赠送的礼品,而普通会员都不享受.单击[确 ...
- Java基础-程序流程控制第一弹(分支结构/选择结构)
Java基础-程序流程控制第一弹(分支结构/选择结构) 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.if语句 1>.if语句的第一种格式 if(条件表达式){ 语句体: ...
- C++之程序流程_选择结构
C/C++支持最基本的三种程序运行结构:==顺序结构.选择结构.循环结构== * 顺序结构:程序按顺序执行,不发生跳转* 选择结构:依据条件是否满足,有选择的执行相应功能* 循环结构:依据条件是否满足 ...
- 黑马程序员——C语言基础 流程控制 选择结构和循环结构
---恢复内容开始--- Java培训.Android培训.iOS培训..Net培训.期待与您交流! (以下内容是对黑马苹果入学视频的个人知识点总结) (一)流程控制 1> 顺序结构:默认的流程 ...
- 使用java理解程序逻辑 第三章 选择结构一
if 选择结构: if(条件){ 代码块 //条件成立后要执行的代码.可以是一条语句,也可以是一组语句 } 可以处理单一或组合条件的情况. if-else 选择结构: if(条件){ ...
- Java程序流程控制:判断结构、选择结构、循环结构
本文内容: 判断结构 if 选择结构 switch 循环结构 while do-while for for each break.continue return 首发时间:2017-06-22 21: ...
- MATLAB顺序结构程序和switch实现选择结构
数据操作 (1)数据输入: A=input(提示信息,选项) (2)数据输出: disp(输出项) (3)程序暂停 pause(延迟秒数)若无内容,则需用户按任意键继续 3.2if语句 整非零为真 矩 ...
随机推荐
- 第1节 Scala基础语法:14、15、list集合练习
package cn.itcast.collect /** *作业题 */object ListTest { def main(args: Array[String]): Unit = { //创建一 ...
- Atcoder Grand Contest 037C(贪心,优先队列,思维)
#define HAVE_STRUCT_TIMESPEC//编译器中time.h和phread.h头文件中timespec结构体重名,故加此行#include<bits/stdc++.h> ...
- 人物 - Larry Elison
甲骨文公司创始人 甲骨文公司首席執行官 狂人,偏执狂 曾说:"Winning is not enough. All others must lose" Only the paran ...
- Write-up-Bulldog2
关于 下载地址:点我 哔哩哔哩:哔哩哔哩 信息收集 网卡:vboxnet0,192.168.56.1/24,Nmap扫存活主机发现IP为192.168.56.101 ➜ ~ nmap -sn 192. ...
- [Linux] day02——什么是Linux
什么是linux? 一种操作系统计算机 = 硬件 +软件系统软件 = 内核 + 驱动应用软件 编程 上网 linux系统构成linux内核基本库 应用程序-------------------常见的操 ...
- Lesson 9 Royal espionage
What important thing did King Alfred learn when he penetrated the Danish camp of Guthrum? Alfred the ...
- 隐藏浏览器body的滚动条,并进行滚动
在使用html2canvas插件的时候,发现截图完成后右侧区域被覆盖了一点,后面才发现是滚动器占了位置 网上有些解决滚动条的方法,不过他们都是相对盒子的,而我这个是对body的 最终发现引用下面这个c ...
- http-equiv属性的属性值X-UA-Compatible
参考:https://blog.csdn.net/changjiangbuxi/article/details/26054755
- 第2节 storm路由器项目开发:1 - 7、网络路由器项目
网安需求: 1:IFTTT:随着物联网的兴起,if this then that .如果出现这种情况,那么及时反映做出对应的操作. 判断手机号黑白名单,mac地址黑白名单.如果是碰到手机号或者mac地 ...
- docker学习笔记-05:DockerFile解析
一.DockerFile是什么 1.DockerFile是用来构建docker镜像的构建文件,是由一系列参数和命令构成的脚本. 2.构建三步骤: 手动编写一个dockerfile文件,然后直接dock ...