You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
713 B
33 lines
713 B
#include <iostream>
|
|
using namespace std;
|
|
// C++入门经典-例3.13-不加break的switch判断语句
|
|
// https://blog.csdn.net/lovemi93/article/details/90702825
|
|
|
|
int main() {
|
|
char c;
|
|
while (1) {
|
|
cin >> c;
|
|
if (c == 'q') break;
|
|
|
|
switch (c) {
|
|
case 'A':
|
|
cout << "1 ";
|
|
break;
|
|
case 'B':
|
|
cout << "3 ";
|
|
case 'C':
|
|
cout << "3 ";
|
|
case 'D':
|
|
cout << "Here!";
|
|
cout << "5 ";
|
|
break;
|
|
case 'E':
|
|
cout << "5 ";
|
|
break;
|
|
default:
|
|
cout << "9 " << endl;
|
|
}
|
|
cout << endl;
|
|
}
|
|
return 0;
|
|
} |