算法可视化
入门执行逻辑
if-else 分支判断
程序根据条件决定走哪条路:条件成立执行 if 分支,否则依次尝试 else if,最后都不满足走 else。
main.cpp第 4 行
1#include <iostream>
2using namespace std;
3int main() {
4 int score = 85;
5 if (score >= 90) {
6 cout << "优秀";
7 } else if (score >= 60) {
8 cout << "及格";
9 } else {
10 cout << "不及格";
11 }
12 return 0;
13}
变量表0 个变量
还没有变量,执行到声明语句后出现
1/6
进入 main 函数
1 / 6