我正在学习CPP,在使用CodeBlocks空闲时出现了这个错误。 它不会运行。
#include <iostream>
// using switch statements
using namespace std;
const float fac = 2.54;
float x , in,cm;
char ch = 0;
int main(){
switch (ch) {
case 'i':
in=x;
cm=x/fac;
break;
case 'c':
in = x/fac;
cm =x;
break;
default:
in=cm=0;
break;
}
}
只需将粘贴从此页复制回IDE。 我的CodeBlocks执行此操作时没有任何错误。 我没有足够的特权来评论。