分支与循环
int score = 85;
if (score >= 90) cout << "优秀";
else cout << "继续加油";
for (int i = 0; i < 5; ++i) cout << i << " ";
函数
int add(int a, int b = 10) { // 默认参数
return a + b;
}
cout << add(5); // 15
cout << add(5, 3); // 8
C++ 支持函数重载:同名函数只要参数个数或类型不同,就可以共存。