C++语言提供了两种按照条件执行的语句:
if语句:根据条件决定控制流
switch语句:计算整型表达式的值,并根据这个值从几条执行路径中选择一条
和golang不同的是,C++语言中条件语句的condition必须用括号括起来。
// 普通的if语句 if (condition) statement // if-else语句 if (condition) statement else statement2