关于下面C++代码中的switch/case语句:"Case 1"显然是假的,那么它是如何/为什么进入do-while循环?
#include <iostream>
using namespace std;
int main() {
int test = 4;
switch(test) {
case 1: do {
case 2: test++;
case 3: test++;
case 4: cout << "How did I get inside the do-while loop?" << endl; break;
case 5: test++;
} while(test > 0);
cout << test << endl;
}
}
Run Code Online (Sandbox Code Playgroud) c++ ×1