妙手小村医漫画下载:vb编程问题

来源:百度文库 编辑:高考问答 时间:2024/05/05 07:35:06
我要普通计算机的源代码
只是只普通的计算机,有加,减,乘,除,等功能就可以了

我做了一个封装成dll了,源代码丢了
告诉你思路吧
用两个数组分别保存计算符和计算数
计算之前对表达式进行判断,去掉非法字符
扫描表达式
遇到计算符时,判断与上一个计算符的优先级,底的话就运算上一个计算符,否则就保存到数组中
直到没计算符
不但可以计算+、-、×、/、还可以计算^/、(、)等

不行啊,这个问题太有深度了。。。
容我考虑两天。。

这问题是怎么搞的。

问问微软吧。

你建3个text,4个option,1个command
前两个text用于输入数据
4个option分别是 + - * /
command是“计算”

Option Explicit
Dim a As Integer
Dim b As Integer
Dim result As Integer
---------------------------------
Private Sub Command1_Click()
a = CInt(Text1.Text)
b = CInt(Text2.Text)
If Option1.Value = True Then
result = a + b
End If
If Option2.Value = True Then
result = a - b
End If
If Option3.Value = True Then
result = a * b
End If
If Option4.Value = True Then
result = a / b
End If
Text3.Text = result
End Sub
---------------------------------
你满意吗?