Switch中的选择怎么不能选择了?
ComboBox1中有两个值:8和12.
如下代码,执行起来怎么总是执行Case为12的语句。
void __fastcall TForm1::Button4Click(TObject *Sender){ double degree, rad, pi=3.141592653589793; int sel_item=ComboBox1->ItemIndex; AnsiString Angel=ComboBox1->Items->Strings[sel_item]; int Angelint = StrToInt(Angel); degree =StrToFloat(Angel); rad = degree*pi/180; Edit33->Text=Angelint; switch(Angelint) { case 8: Edit33->Text=rad; case 12: Edit33->Text=rad/100; default: break; }}
switch(Angelint) { case 8: Edit33->Text = rad; break; case 12: Edit33->Text = rad / 100; break; default: break; }