1樓:匿名使用者
private sub command1_click()text1 = ""
for i = 1 to 45 - 7
for j = 1 to (45 - 6) / 2for k = 1 to (45 - 3) / 5if i + j * 2 + k * 5 = 45 thenn = n + 1
end if
next
next
next
text1 = n
end sub
private sub command2_click()for i = 87 to 9786 - 91 step 87for j = 91 to 9786 - 87 step 91if i + j = 9786 then text2 = jnext
next
end sub
2樓:匿名使用者
1、問題歸結為:
設所取一元、二元、五元的硬幣為x,y,z枚.則x+2y+5z=45
x+y+z<=23
求上述問題的非零整數解。
可用窮舉法。
dim x as integer, y as integer, z as integer
dim k as integer
for x = 1 to 21
for y = 1 to 21
for z = 1 to 21
if x + y + x <= 23 and x + 2 * y + 5 * z = 45 then
' print "x="; x; "y="; y; "z="; z' 不用求xyz的值,這句就不用了
k=k+1
end if
next z
next y
next z
print "k="; k
2,dim i as integer, j as integer,k as integer
for i = 87 to 9786 - 91 step 87for j = 91 to 9786 - 87 step 91if i + j = 9786 then text2 = jk=k+1
next j
next i
print "k="; k
3樓:蒯問奇英華
private
subcommand1_click()
dimsum,
pi,nn=
1dountil1/
n^2<10^
-5sum
=sum+1
/n^2
n=n+
1looppi=
sqr(6
*sum)
piendsub
VB程式設計問題,VB程式設計難嗎?
非常簡單,你看插圖,一切都在圖中。如下 在窗體中新增一個label1 兩個預設command1和command2。一切屬性預設 不用修改。private sub command1 click if command1.caption 有邊框 then label1.borderstyle 1 comm...
VB程式設計的問題
if ssl then ssl tt option explicit private subform load timer1.interval 500 這裡可以改成別的時間段,我是以0.5秒變化一次來寫的endsub private subtimer1 timer iflabel1.forecolo...
VB程式設計題目,vb程式設計題目
private sub mand1 click dim i as integer,j as integer,k as integer dim a 1 to 10 as integerdim max as integer,min as integer,pj as single dim sumnum a...