1樓:匿名使用者
簡單,一會給你做一個。
dim x as single, y as single, fh as string
private sub command1_click(index as integer)
dim k as integer
k = command1(index).index
if k <> 10 then
if right(text1.text, 1) = "." then
text1.text = text1.text & k
elseif int(val(text1.text)) = val(text1.text) and right(text1.text, 1) <> "." then
text1.text = val(text1.text) * 10 + k
elseif int(val(text1.text)) <> val(text1.text) and right(text1.text, 1) <> "." then
text1.text = text1.text & k
end if
else
text1.text = text1.text & "."
end if
if fh = "" then
x = val(text1.text)
else
y = val(text1.text)
end if
end sub
private sub command2_click(index as integer)
dim k1 as integer
k1 = command2(index).index
text1.text = ""
if command2(k1).caption = "+" then
fh = "+"
elseif command2(k1).caption = "-" then
fh = "-"
elseif command2(k1).caption = "*" then
fh = "*"
elseif command2(k1).caption = "/" then
fh = "/"
end if
end sub
private sub command3_click()
if x <> 0 and y <> 0 then
if fh = "+" then
text1.text = x + y
elseif fh = "-" then
text1.text = x - y
elseif fh = "*" then
text1.text = x * y
elseif fh = "/" then
if y = 0 then
msgbox "除數不能為0", 16, "錯誤!"
exit sub
end if
text1.text = x / y
end if
x = val(text1.text)
else
msgbox "運算元不足!", 16, "錯誤!"
end if
end sub
private sub command4_click()
text1.text = "": x = 0: y = 0: fh = ""
end sub
private sub form_load()
text1.text = "": x = 0: y = 0: fh = ""
end sub
2樓:匿名使用者
我有成品。你需要嗎?
如何使用c語言做簡單的計算器,如何使用C語言做一個簡單的計算器
我試一下了 include include int main void return 0 該例中乘法用的是x,因為 有特別的含義 include using namespace std int main system pause return 0 編這個肯定不是一會兒的事,不過我建議你去csdn下一...
計算器上最上邊的那幾個按鍵是什麼意思,做什麼用的,怎麼用呢
tax 稅 rate 比率 mrc memory read clear 記憶讀取 清除mu 關於 mu 的用法如下 加價計算 100 100 5 105 100 5 mu 105 變化率 100 80 80 25 100 80 mu 25 標價計算 成本為120,利潤的25 的標價 就賣的 為得 1...
已知某商店有兩個進價不同的計算器,都賣了100元,其中盈
設這兩bai個計算器中盈利的那個 的進價du為x元,虧損的那zhi個的進價為daoy元,由題意,得x 1 60 版 100,權y 1 20 100,解得 x 62.5,y 125,這兩件衣服的進價為 62.5 125 187.5元,這兩件衣服的售價為 100 100 200元,200 187.5 1...