早教吧作业答案频道 -->其他-->
求几道VB题目的解答第一题运行下面程序,单击窗体后第123行分别显示什么(答案151317)dimiasinteger,sasintegerfori=1to10s=s+iifs>10thenprintss=0endifnextiendsub第二题total=0form=1to3
题目详情
求几道VB题目的解答第一题 运行下面程序,单击窗体后第123行分别显示什么(答案15 13 17) dim i as integer,s as integer for i =1 to 10 s=s+i if s>10 then print s s=0 end if next i end sub 第二题 total =0 for m= 1 to 3 if m>=1 then part=1 elseif m>=2 then part=2 elseif m>=3 then part=3 else part=4 end if print part total=total+part next m print total 运行时输出结果(答案1 1 1 3) 第三题 运行下面程序,第13行分别是(答案d dbAeB) dim mst as string,mst1 as string,mst2 as string dim i as integer mst1="CeBbAd" for i=len(mst1)to 1 step -2 mst2=mid(mst1,i-1,2) mst=mst&mst2 print mst next i end sub 第四题执行下面的command1_click 事件后,text1,text2显示内容为(答案VISUAL 2008.10.11) private sub command1_click () dim s as string,i as integer const ch as string="0123456789" s="2L0A08U.1SI0V.11" text1="" text2="" for i =1 to len(s) if instr(ch,mid(s,i,1))=0 then text1=mid(s,i,1)&text1 else text2=text2&mid(s,i,1) end if next i end sub 小弟马上要考试,辛苦打出来,求那位告诉我为什么,详细一点,拜托!
▼优质解答
答案和解析
dim i as integer,s as integer for i =1 to 10 s=s+i if s>10 then print s s=0 end if next i end sub 当s=1+2+3+4+5=15 s>10 显示15,赋予s=0 当s=6+7=13 s>10 显示13,s=0 当s=8+9=17 s>10 显示17,s=0 total =0 for m= 1 to 3 if m>=1 then part=1 elseif m>=2 then part=2 elseif m>=3 then part=3 else part=4 end if print part total=total+part next m print total i=1 part=1 total=1 显示1 i=2 part=1 total=2 显示1 i=3 part=1 total=3 显示1 循环结束 显示total,3 if语句中其实条件是包含关系,所以满足第一个条件后就结束了 所以一般分支语句的条件应该是互斥的,要不会得到错误的结果 dim mst as string,mst1 as string,mst2 as string dim i as integer mst1="CeBbAd" for i=len(mst1)to 1 step -2 mst2=mid(mst1,i-1,2) mst=mst&mst2 print mst next i end sub i的取数是6 to 1 -2,循环即为i=6,4,2 i=6 mst2=mid("CeBbAd",5,2)="Ad",mst="Ad" i=4 mst2=mid("CeBbAd",3,2)="Bd",mst="AdBd" i=2 mst2=mid("CeBbAd",1,2)="Ce",mst="AdBdCe" 我觉得答案是AdAdBbAdBbCe 错了?请高手指正吧 private sub command1_click () dim s as string,i as integer const ch as string="0123456789" s="2L0A08U.1SI0V.11" text1="" text2="" for i =1 to len(s) if instr(ch,mid(s,i,1))=0 then text1=mid(s,i,1)&text1 else text2=text2&mid(s,i,1) end if next i end sub i=1 to 16 i=1 instr(ch,mid(s,1,1))0 text2=mid(s,1,1)="2" i=2 instr(ch,mid(s,2,1))=0 text1="L" i=3 instr(ch,mid(s,3,1))0 text2="2" & mis(s,3,1)="20" i=4 instr(ch,mid(s,4,1))=0 text1=mid(s,4,1) & "L"="AL" ………… 提一下,好像const ch as string="0123456789" 里面应该包含一个小数点
看了求几道VB题目的解答第一题运行...的网友还看了以下:
问一道预备班的题目1-1/3=1/3×2,1/3-1/5=1/3×1/5×2,1/5-1/7=1/ 2020-05-14 …
求minecraft(我的世界)更多生物群系整合包(1‘7.2)如果可以的话.最好有更多生物mod 2020-05-14 …
设椭圆C:x^2/a^2+y^2/b^2=1(a>b>0)的离心率e=1/2,右焦点到直线x/a+ 2020-05-16 …
九宫格题目:+++42++7+二格+9+1++++2三格++++5+8+4四格++6592+18五 2020-06-10 …
当x->无穷,1/(ax^2+bx+c)=o(1/x+1),则abc一定为a0,b,c为任意常数怎 2020-06-11 …
指出下列各组条件中,条件p是结论q的什么条件(1)p:ab>o,q:/a/>/b/(4)p:整数a 2020-06-12 …
O.999x0.7+0.111x3.7简便算法O.999xO.7+O.111x3.7简便方法怎么算 2020-07-24 …
用竖式计算,并验算.①6.8÷o.h②4.6÷1.h③h.4÷o.18④h.h8÷8.6⑤h.98 2020-07-29 …
o.9就循环=1吗?1/7=0.142857循环2/7=0.285714循环1/7x2=2/70.1 2020-10-31 …
求大学文科数学极限方面的题目1.设f(x)=x+3/x^2+x-6,求极限lim(x-o)fx和li 2020-11-21 …