求助一个VBS问题...

来源:百度知道 编辑:UC知道 时间:2024/07/06 21:36:34
帮看下 下面有那些错误。
dim a,b,c,d,e,f,g,h,i,l,m,n,o,p,q,r,s,t,u,v,w
f=0
a=inputbox("请输入公鸡单价")
b=inputbox("请输入母鸡单价")
c=inputbox("请输入小鸡单价")
m=inputbox("请输入购买总数")
n=inputbox("请输入总价")
o=n/a
p=n/b
q=n/c
r=int(o)
s=int(p)
t=int(q)
for u=0 to r
for v=0 to s
for w=0 to t
if u+v+w=m and u*a+v*b+w*c=n then
d="公鸡"&u&"母鸡"&v&"小鸡"&w
f=f+1
l=l&d&vbcrlf
end if
next
next
next
msgbox(f&"种"&vbcrlf&l)

'验证通过。比较的时候要用Cint(或者int)转换

dim a,b,c,d,f,m,n,u,v,w
f=0
a=inputbox("请输入公鸡单价")
b=inputbox("请输入母鸡单价")
c=inputbox("请输入小鸡单价")
m=inputbox("请输入购买总数")
n=inputbox("请输入总价")
for u=0 to n/a
for v=0 to n/b
for w=0 to n/c
if Cint(u+v+w)=Cint(m) and Cint(u*a+v*b+w*c)=Cint(n) then
f=f+1
d=d&"公鸡"&u&"母鸡"&v&"小鸡"&w&vbcrlf
end if
next
next
next
msgbox(f&"种"&vbcrlf&d)