不能直接赋值,是通过间接地。将运算符赋值给一个字符串变量,通过条件语句进行转化成相应的四则运算操作。例如
sub form_click()
dim f as string
dim a as integer ,b as integer
a = 3
b = 5
f = InputBox("请输入运算符")
select case f
case "+"
c = a+b
case "-"
c = a-b
case "*"
c = a*b
case "/"
c = a/b
end select
print c
end sub
就用字符串是什么的随便取个名字(如名字1,名字2,名字3等),然后再用if then 当名字1时,谁乘以谁,当名字2时谁加上谁,就可以了
可以赋值给字符串变量:
dim a as string,b as integer
a="2+3"
b=2+3
print a; "="; b