例子:
int a = 10;
int b = 20;
if (a > b) {
std::cout << "a > b" << std::endl;
} else if (a < b) {
std::cout << "a < b" << std::endl;
} else {
std::cout << "a == b" << std::endl;
}
运行结果
a < b
例子:
int a = 10;
int b = 20;
if (a > b) {
std::cout << "a > b" << std::endl;
} else if (a < b) {
std::cout << "a < b" << std::endl;
} else {
std::cout << "a == b" << std::endl;
}
运行结果
a < b
本文标题:C++自学计划-if-08
本文链接:https://www.haomeiwen.com/subject/werqkqtx.html
网友评论