骰子掷出几点,就把它念出来: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;
}
写好了先点「运行」试试示例,没问题再点「提交」。