vbs难题{急急急!!}在线等啊
给出vbs程序编码不要太深奥,最好用初级的函数要有解释1\将十进制得数12345转化成二进制数2\用0\1\2\3\4\5\6\7\8\9这就张卡片拼成5位数,奇数偶数各...
给出vbs程序编码
不要太深奥,最好用初级的函数
要有解释
1\将十进制得数12345转化成二进制数
2\用0\1\2\3\4\5\6\7\8\9这就张卡片拼成5位数
,奇数偶数各有几个
3\某自然数与199的乘积的最末六位是666666,这个自然数最小是几?
4\试编写一个乘法练习程序:二位数乘一位数随机出数用户输入答案后能做判断如果用户算错,则出示竖式给用户看
w=a mod i
s=s & w & ""
a=(a-w)/i
loop
msgbox strreverse(s)
for a=1 to 9
for b=0 to 9
for c=0 to 9
for d=0 to 9
for e=0 to 9
x=a*10000+b*1000+c*100+d*10+e
if a<>b and a<>c and a<>d and a<>e and b<>c and b<>d and b<>e and c<>d and c<>e and d<>e then
k=1
else
k=0
end if
if k=1 and e mod 2=0 then
i=i+1
end if
if k=1 and e mod 2=1 then
l=l+1
next
next
next
next
next
msgbox "偶数有" & i & "个" & vbcr & "奇数有" & l & "个"
for i=0 to 100
a=i*1000000+666666
if a mod 199=0 then
msgbox a & vbcr & a/199
exit for
end if
next
a1=1
b1=9
randomize
s1=int((a1-b1+1)*rnd+b1)
a2=10
b2=99
randomize
s2=int((a2-b2+1)*rnd+b2)
msgbox s1 & "*" & s2 & "=?"
w=s1*s2
a=cint(inputbox(""))
if a=w then
msgbox "yes"
else
s=s & " " & s1 & vbcr & "* " & s2 & vbcr & "-----" & vbcr & " " & s1*s2
msgbox "no" & vbcr & s
end if
我做好了不过也谢谢你们啊 展开
不要太深奥,最好用初级的函数
要有解释
1\将十进制得数12345转化成二进制数
2\用0\1\2\3\4\5\6\7\8\9这就张卡片拼成5位数
,奇数偶数各有几个
3\某自然数与199的乘积的最末六位是666666,这个自然数最小是几?
4\试编写一个乘法练习程序:二位数乘一位数随机出数用户输入答案后能做判断如果用户算错,则出示竖式给用户看
w=a mod i
s=s & w & ""
a=(a-w)/i
loop
msgbox strreverse(s)
for a=1 to 9
for b=0 to 9
for c=0 to 9
for d=0 to 9
for e=0 to 9
x=a*10000+b*1000+c*100+d*10+e
if a<>b and a<>c and a<>d and a<>e and b<>c and b<>d and b<>e and c<>d and c<>e and d<>e then
k=1
else
k=0
end if
if k=1 and e mod 2=0 then
i=i+1
end if
if k=1 and e mod 2=1 then
l=l+1
next
next
next
next
next
msgbox "偶数有" & i & "个" & vbcr & "奇数有" & l & "个"
for i=0 to 100
a=i*1000000+666666
if a mod 199=0 then
msgbox a & vbcr & a/199
exit for
end if
next
a1=1
b1=9
randomize
s1=int((a1-b1+1)*rnd+b1)
a2=10
b2=99
randomize
s2=int((a2-b2+1)*rnd+b2)
msgbox s1 & "*" & s2 & "=?"
w=s1*s2
a=cint(inputbox(""))
if a=w then
msgbox "yes"
else
s=s & " " & s1 & vbcr & "* " & s2 & vbcr & "-----" & vbcr & " " & s1*s2
msgbox "no" & vbcr & s
end if
我做好了不过也谢谢你们啊 展开
2个回答
展开全部
1.
num=12345
Do while num>=2
temp=temp&cstr(num Mod 2)
num=Int(num/2)
Loop
msgbox "12345="&temp
#####################################################
2.
for i = 1234 to 98765
mark=0
str=cstr(i)
for j = 1 to len(str)-1
for k = j+1 to len(str)
if mid(str,j,1)=mid(str,k,1) then
mark=mark+1
end if
next
next
if mark = 0 then
if (i mod 2)=0 then
odd=odd+1
else
even=even+1
end if
end if
next
msgbox "奇数有:"&odd&"偶数有:"&even
#######################################################
3.
for i = 1 to 100
if ((i*1000000+666666) mod 199) = 0 then
msgbox "这个自然数最小是:"&(i*1000000+666666)/199
exit for
end if
next
#######################################################
4.
Randomize
num1=int(100*Rnd)
num2=int(10*Rnd)
equ=num1&"*"&num2
ans = inputbox(equ & "=?")
if int(ans) = eval(equ) then
msgbox "Right!"
else
if eval(equ)<99 then
Msgbox "计算如下:"&chr(13)&num1&chr(13)&"* "&num2&chr(13)&"-----"&chr(13)&eval(equ),vbMsgBoxRight,"prompt "
else
num3=int(num1/10)
num4=num1-num3*10
Msgbox "计算如下:"&chr(13)&num1&chr(13)&"* "&num2&chr(13)&"------"&chr(13)&num4*num2&chr(13)&"+ "&num3*num2&" "&chr(13)&"------"&chr(13)&eval(equ),vbMsgBoxRight,"prompt "
end if
end if
num=12345
Do while num>=2
temp=temp&cstr(num Mod 2)
num=Int(num/2)
Loop
msgbox "12345="&temp
#####################################################
2.
for i = 1234 to 98765
mark=0
str=cstr(i)
for j = 1 to len(str)-1
for k = j+1 to len(str)
if mid(str,j,1)=mid(str,k,1) then
mark=mark+1
end if
next
next
if mark = 0 then
if (i mod 2)=0 then
odd=odd+1
else
even=even+1
end if
end if
next
msgbox "奇数有:"&odd&"偶数有:"&even
#######################################################
3.
for i = 1 to 100
if ((i*1000000+666666) mod 199) = 0 then
msgbox "这个自然数最小是:"&(i*1000000+666666)/199
exit for
end if
next
#######################################################
4.
Randomize
num1=int(100*Rnd)
num2=int(10*Rnd)
equ=num1&"*"&num2
ans = inputbox(equ & "=?")
if int(ans) = eval(equ) then
msgbox "Right!"
else
if eval(equ)<99 then
Msgbox "计算如下:"&chr(13)&num1&chr(13)&"* "&num2&chr(13)&"-----"&chr(13)&eval(equ),vbMsgBoxRight,"prompt "
else
num3=int(num1/10)
num4=num1-num3*10
Msgbox "计算如下:"&chr(13)&num1&chr(13)&"* "&num2&chr(13)&"------"&chr(13)&num4*num2&chr(13)&"+ "&num3*num2&" "&chr(13)&"------"&chr(13)&eval(equ),vbMsgBoxRight,"prompt "
end if
end if
展开全部
1.
x=12345
m=x
Do while x>=2
m=x Mod 2
x=Int(x/2)
WScript.echo x&" "&m
Loop
Microsoft (R) Windows Script Host Version 5.7
版权所有(C) Microsoft Corporation 1996-2001。保留所有权利。
6172 1
3086 0
1543 0
771 1
385 1
192 1
96 0
48 0
24 0
12 0
6 0
3 0
1 1
***** script completed *****
结果:11000000111001
x=12345
m=x
Do while x>=2
m=x Mod 2
x=Int(x/2)
WScript.echo x&" "&m
Loop
Microsoft (R) Windows Script Host Version 5.7
版权所有(C) Microsoft Corporation 1996-2001。保留所有权利。
6172 1
3086 0
1543 0
771 1
385 1
192 1
96 0
48 0
24 0
12 0
6 0
3 0
1 1
***** script completed *****
结果:11000000111001
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询