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语句 整非零为真 矩 ...
随机推荐
- java 实现用户自由选择字段实现导出EXCEL表格
package com.thinkgem.jeesite.common.utils.excel; import java.io.File; import java.io.OutputStream; i ...
- Golang mysql数据库
基本操作: Open() – create a DB Close() - close the DB Query() - 查询 QueryRow() -查询行 Exec() -执行操作,update,i ...
- How to backup on MSSQL by table level ?
MSSQL is good database. Unlike as Oracle, it seems that can not backup sqlserver databasee tables ...
- h5 穿透滚动
引子 h5 页面有弹窗浮层时,浮层之下若产生了滚动,滑动浮层时会让其产生滚动.这是示例页面,移动端访问如下: Origin My GitHub 原因 找到的信息里面有两种说法: 使用了 -webkit ...
- uniGUI之新窗口uniForm(19)
然后 保存,在这里 重命名窗口 //主窗口 调用 // NewForm2.UniForm1.Show() ; //非阻塞 NewForm2.UniForm1.ShowModal();//阻塞 //子窗 ...
- Tensorflow之AttributeError: module 'tensorflow' has no attribute 'mul'
tf.mul已经在新版本中被移除,请使用 tf.multiply 代替
- 浅谈脱壳中的附加数据问题(overlay)
Author:Lenus -------------------------------------------------- 1.前言 最近,在论坛上看到很多人在弄附加数据overlay的问题,加上 ...
- linux的切换目录操作
cd 是 change directory 用法 cd [目录名] 几个特殊目录: ”.“或者”./“当前目录 ”..“或者"../"上级目录 “../ ...
- AngularJS 官方启动文档
参考:https://angular.io/guide/quickstart 中文:http://www.angularjs.net.cn/
- Redis的两个典型应用场景
Redis简介 Redis是目前业界使用最广泛的内存数据存储.相比memcached,Redis支持更丰富的数据结构,例如hashes, lists, sets等,同时支持数据持久化.除此之外,Red ...