34. if-else
语法讲解
今天学: else 是"否则",条件不成立时执行。
#include <iostream>
using namespace std;
int main() {
int x = 3;
if (x % 2 == 0) {
cout << "even" << endl;
} else {
cout << "odd" << endl;
}
return 0;
}
小练习
输出是什么?
提交要求: 只提交最终输出结果,不要添加多余的说明或引号。
全部评论