C++自学计划-switch-09
2018-12-17 本文已影响1人
你缺少想象力
例子:
int type = 2;
switch (type) {
case 1:
std::cout << 1 << std::endl;
break;
case 2://故意没写break
std::cout << 2 << std::endl;
case 3:
std::cout << 3 << std::endl;
break;
case 4:
std::cout << 4 << std::endl;
break;
default:
std::cout << 5 << std::endl;
}