因此,我正在开发Monopoly的命令行翻版。我正在使用cpp。但是,当我使用switch语句时,它向我抛出一条错误消息。下面是开关代码:
switch (e) {
case 'C':
break;
case 'M':
break;
case 'R':
printf("Time to recruit some good troops!\n Automatically rolling the die.\n");
int die=dice()*2;
printf("Congratulations! You enlisted %d troops!\n");
break;
case 'B':
break;
case 'F':
break;
case 'A':
printf("You did some agriculture with your fellow citizens. You earned a lot of profit!\n Automatically rolling the die.\n");
int die=dice()*2000;
printf("Congratulations! You earned %d money! That's a lot!\n");
player[pNo].money+=die;
break;
case 'S':
break;
case 'T':
break;
}
Description Resource Path Location Type
cannot jump from switch statement to this case label RichmanMA.cpp /Trash line 40 C/C++ Problem
cannot jump from switch statement to this case label RichmanMA.cpp /Trash line 43 C/C++ Problem
cannot jump from switch statement to this case label RichmanMA.cpp /Trash line 46 C/C++ Problem
cannot jump from switch statement to this case label RichmanMA.cpp /Trash line 52 C/C++ Problem
cannot jump from switch statement to this case label RichmanMA.cpp /Trash line 55 C/C++ Problem
这些错误消息是直接从eclipse复制的。
编辑:为澄清起见,“垃圾箱”是我的项目的名称。