使用switch语法时出现jump to case label错误
此处case 8 : case 9: default 都出现了这个错误,但是在这些case中出现的变量都已经在作用域内进行了定义。故不知错误产生的原因
完整代码
#include <iostream>
#include <iomanip>
#include <cmath>
int main()
{
using namespace std;
int problem, result;
cin >> problem;
switch(problem)
{
case 1 :
cout << "I love luogu!" << endl;
break;
case 2 :
cout << 2 + 4 << ' ' << 10 - 2 - 4 << endl;
break;
case 3 :
cout << 14 / 3 << endl << 14 - 14 % 3 << endl << 14 % 3 << endl;
break;
case 4 :
cout << fixed << setprecision(6) << 500.0 / 3 << endl;
break;
case 5 :
cout << (220 + 260) / (12 + 20) << endl;
break;
case 6 :
cout << sqrt(pow(6,2) + pow(9,2)) << endl;
break;
case 7 :
int deposit = 100;
cout << deposit+10 << endl;
deposit+=10;
cout << deposit-20 << endl;
deposit-=20;
cout << 0 << endl;
break;
case 8 :
double pi = 3.1415923;
int r = 5;
cout << 2 * pi * r << endl
<< pi * pow(r,2) << endl
<< 4 * pi * pow(r,3) / 4 << endl;
break;
case 9 :
int peach = 1;
cout << ((((peach + 1) * 2 + 1)*2)+1)*2 << endl;
break;
default:
break;
}
return 0;
}