#include <iostream> using namespace std; int main() { //break使用 //1.switch语句中; cout << "选择副本难度" << endl; cout << "1.普通" << endl; cout << "2.中等" << endl; cout << "3.困难" << endl; int select = 0; cin >> select; switch (select) { case 1: cout << "你选择是普通难度" << endl; break;//退出switch语句 case 2: cout << "你选择是中等难度" << endl; break; case 3: cout << "你选择困难难度" << endl; break; default: break; } //2.出现在循环语句中; for (size_t i = 0; i < 10; i++) { if (i == 5) { break; } cout << i << endl; } //3.出现在嵌套循环语句中 for (size_t i = 0; i < 10; i++) { for (size_t j = 0; j < 10; j++) { if (j == 5) { break;//退出内层循环 } cout << "* "; } cout << endl; } system("pause"); return 0; }