Re: [問題] 計算機程式防呆

看板C_and_CPP作者 (楓霧)時間16年前 (2009/05/12 13:50), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串3/3 (看更多)
有個比較簡單的方法,可以去掉英文字母,空白鍵,特殊字元等。 std::string str = "1234567890.+-*/"; if( str.find(Key) == std::string::npos && Key != VK_BACK && Key != VK_TAB && Key != VK_RETURN) { ShowMessage("請輸入數字"); Key =0; } 但是還沒有辦法判斷00.22...1這種數字。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.118.207.32
文章代碼(AID): #1A2GuRKc (C_and_CPP)
文章代碼(AID): #1A2GuRKc (C_and_CPP)