骰子擲出幾點,就把它念出來:1 念 one,2 念 two,3 念 three,其它念 many。前兩個和最後一個都寫好了,補上 3 那一條。這次擲出 3。
three
#include <iostream>
using namespace std;
int main() {
int n = 3;
switch (n) {
case 1:
cout << "one" << endl;
break;
case 2:
cout << "two" << endl;
break;
// 在這裡寫:n 是 3 的時候顯示 three
default:
cout << "many" << endl;
}
return 0;
}
寫好了先點「執行」試試示例,沒問題再點「提交」。