Re: [問題] 求助BCB的次方問題

看板C_and_CPP (C/C++)作者 (楓霧)時間16年前 (2009/07/10 23:19), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串3/3 (看更多)
跟你寫的差不多,不過主要是防呆處理 在LabeledEdit1KeyPress事件中寫初步防呆處理 std::string str = "-1234567890."; if(str.find(Key) == std::string::npos && Key != VK_BACK && Key != VK_TAB && Key != VK_RETURN) Key =0; 然後加個button,在button的Click事件中寫第二次防呆處理,防止-- ..等情況 int x = StrToFloatDef(LabeledEdit1->Text,-1); int y = StrToFloatDef(LabeledEdit2->Text,-1); if(x!=-1 & y!=-1) { double a = StrToFloat(LabeledEdit1->Text); double b = StrToFloat(LabeledEdit2->Text); double c = pow(a,b); } else { LabeledEdit1->Text = ""; LabeledEdit2->Text = ""; } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.118.207.32 ※ 編輯: maplefog 來自: 140.118.207.32 (07/10 23:20)
文章代碼(AID): #1ALrlh8X (C_and_CPP)
文章代碼(AID): #1ALrlh8X (C_and_CPP)