计算机二级VB上机操作题iWord格式文档下载.docx
- 文档编号:21097542
- 上传时间:2023-01-27
- 格式:DOCX
- 页数:24
- 大小:18.60KB
计算机二级VB上机操作题iWord格式文档下载.docx
《计算机二级VB上机操作题iWord格式文档下载.docx》由会员分享,可在线阅读,更多相关《计算机二级VB上机操作题iWord格式文档下载.docx(24页珍藏版)》请在冰豆网上搜索。
s="
miDEFSDVFGS"
PrintUCase(Mid(s,1,1))&
LCase(Mid(s,2,Len(s)-1))
4、求SIN?
=?
DimxAsInteger
x=Text1.Text
Text2.Text=Sin(x*3.1415926/180)
5、09年(春)上机05
OptionExplicit
OptionBase1
DimkAsInteger,nAsInteger,num()AsInteger,iAsInteger
Do
n=Int(Rnd*900)+100
Ifvalidate(n)Then
k=k+1
ReDimPreservenum(k)
num(k)=n
EndIf
LoopUntilk>
=12
Fori=1ToUBound(num)
IfiMod4<
>
0Then
Text1=Text1&
Str(num(i))
Else
Str(num(i))&
vbCrLf
Nexti
PrivateFunctionvalidate(ByValnAsInteger)AsBoolean
Dimp(3)AsInteger,iAsInteger,jAsInteger,kAsInteger
i=i+1
p(i)=nMod10
n=n\10
LoopUntiln<
=0
Fori=1ToUBound(p)-1
Forj=i+1ToUBound(p)
Ifp(i)=p(j)Thenk=k+1
Nextj
Ifk=1Thenvalidate=True
EndFunction
6、答题
DimresultAsInteger
DimrightqAsInteger
DimwrongqAsInteger
DimaAsInteger
DimbAsInteger
DimfAsInteger
a=Int(Rnd*10)
b=Int(Rnd*10)
f=Int(Rnd*4)+1
SelectCasef
Case1
Label1.Caption="
a"
+"
b"
="
result=a+b
-"
result=a-b
x"
result=a*b
÷
"
result=a/b
EndSelect
PrivateSubCommand3_Click()
IfVal(Text2.Text)=resultThen
Text1.Text=Label1.Caption&
Text2.Text&
√"
rightq=rightq+1
wrongq=wrongq+1
Text1.Text=Text1.Text&
Label1.Caption&
×
Chr(13)+Chr(10)
Text4.Text=rightq
Text8.Text=wrongq
Text7.Text=rightq+wrongq
Text6.Text=Format(rightq+wrongq,"
0.00%"
)
7、求1到100的和
DimsumAsInteger
Fori=1To100
sum=sum+1
Nexti
Printsum
8、6!
sum=1
Fori=1To6
sum=sum*i
9、10!
DimsumAsLong
Fori=1To10
10、判断一个数是否为素数
x=InputBox("
Fori=2Tox-1
IfxModi=0ThenExitFor
Ifi=xThen
MsgBox"
是素数"
Else
不是素数"
EndIf
调用SUB过程判断一个数是否为素数
Subhe(xAsInteger)
Fori=1Tox
sum=sum+i
Printsum
Callhe(100)
Callhe(50)
Callhe(200)
11、求100-200之间所有素数的和
Forx=100To200
Fori=2Tox-1
Ifi=xThen
sum=sum+x
Nextx
12、判断100到999中的水仙花数
Forx=100To999
If(xMod10)^3+(x\100)^3+(x\10Mod10)^3=xThen
Printx
Nextx
13、输入abcde--edcba
DimsAsString
s=InputBox("
Fori=1ToLen(s)
Text1.Text=Text1.Text&
Mid(s,Len(s)-i+1,1)
14、求一篇文章中大小写字母,以及其他字母个数
DimdaAsInteger
DimxiaoAsInteger
DimqtAsInteger
Fori=1ToLen(s)
IfMid(s,i,1)>
="
AndMid(s,i,1)<
z"
Then
xiao=xiao+1
IfMid(s,i,1)>
A"
Z"
da=da+1
qt=qt+1
大写字母个数"
da
小写字母个数"
xiaoxie
其它"
qt
15、金字塔:
Fori=1To5
PrintSpace(5-i)&
String(2*i-1,"
PrintSpace(i)&
String(8-(2*i-1),"
16、九九乘法表
Fori=1To9
Forj=1Toi
Printi&
j&
i*j&
Space
(1);
17、求两个数的最大公约数和最小公倍数
DimabAsInteger
a=InputBox("
b=InputBox("
DimrAsInteger
ab=a*b
r=aModb
DoWhiler<
0
a=b
b=r
r=aModb
Loop
最大公约数"
b
最小公倍数"
ab/b
18、人口问题
DimnAsLong
DimpAsLong
p=1300000000
Whilep<
=2000000000
p=p*(1+0.012)
n=n+1
Wend
Printn&
年后人口达到20亿"
19、字体/颜色/
PrivateSubOption1_Click()
Text1.FontName="
黑体"
PrivateSubOption2_Click()
宋体"
PrivateSubOption3_Click()
隶书"
PrivateSubOption4_Click()
Text1.FontSize=20
PrivateSubOption5_Click()
Text1.FontSize=30
PrivateSubOption6_Click()
Text1.FontSize=15.75
PrivateSubOption7_Click()
Text1.FontBold=True
PrivateSubOption8_Click()
Text1.FontUnderline=True
20、调色板
PrivateSubHScroll1_Change()
Form1.BackColor=RGB(HScroll1.Value,HScroll2.Value,HScroll3.Value)
PrivateSubHScroll2_Change()
PrivateSubHScroll3_Change()
21、图片滚动stretch:
true
PrivateSubForm_Load()
x=100
Image1.Width=HScroll1.Value
HScroll1.Value=HScroll1.Value+x
IfHScroll1.Value>
=HScroll1.MaxThen
x=-x
IfHScroll1.Value<
=0Then
22、计算圆的周长等
DimxAsSingle
DimzcAsSingle
DimmjAsSingle
DimtjAsSingle
Constpi=3.1415926
r=Text1.Text
zc=2*pi*r
mj=pi*r*r
tj=(4/3)*pi*r*r*r
Text1.Text=r
Text2.Text=zc
Text3.Text=mj
Text4.Text=tj
Text1.Text="
Text2.Text="
Text3.Text="
Text4.Text="
Text1.SetFocus
23、开始清除退出
恶魔De诺言"
Command2.Enabled=True
Command2.SetFocus
Command1.Enabled=False
Command1.Enabled=True
Command1.SetFocus
Command2.Enabled=False
24、滚动字符
Label1.Caption=Time
Label1.Left=Label1.Left+100
IfLabel1.Left>
=Form1.WidthThen
Label1.Left=-Label1.Width
25、随机产生100个数,以10行10列排列,求100个数的最大最小值以及平均数
Dima(100)AsInteger
DimmaxAsInteger
DimminAsInteger
DimavrAsInteger/string(单精度)
Fori=1To100
a(i)=Int(Rnd*90)+10
sum=sum+a(i)
avr=sum/100
Printa(i);
IfiMod10=0ThenPrint
100个数的和为"
sum
100个数平均数"
avr
max=a
(1)
min=a
(1)
Fori=2To100
Ifmax<
a(i)Thenmax=a(i)
Ifmin>
a(i)Thenmin=a(i)
最大值"
max
最小值"
min
Ifmax=a(i)ThenPrint"
最大值在第"
i;
位"
Endsub
Privatesubform_load()
Randomize
26、
12345678910
10987654321
Dima(10)AsInteger
Fori=1To10
a(i)=i
DimtAsInteger
Fori=1To5
t=a(i)
a(i)=a(11-i)
a(11-i)=t
27、列表框
List1.AddItem"
1"
2"
3"
4"
5"
6"
7"
8"
Fori=0ToList1.ListCount-1
IfList1.Selected(i)=TrueThen
List2.AddItemList1.List(i)
Fori=List1.ListCount-1To0Step-1
List1.RemoveItemi
28、
112358132134………………
Dima()AsLong
DimnAsInteger
n=InputBox("
ReDima(n)AsLong
a
(1)=1
a
(2)=1
Fori=3Ton
a(i)=a(i-2)+a(i-1)
Fori=1Ton
ReDimPreservea(n)AsLong
Fori=1Ton
Printa(i);
IfiMod8=0ThenPrint
29、
随机产生五个数,并且将五个数字按顺序排列:
Dima(5)AsInteger
a(i)=Int(Rnd*10)+1
Fori=1To4
Forj=i+1To5
Ifa(i)>
a(j)Then
a(i)=a(j)
a(j)=t
30、随机产生100个数,并且将100个数字按顺序排列:
IfiMod10=0ThenPrinta(i)'
成十行十列排列
Fori=1To99
Forj=i+1To100
Ifa(i)<
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机 二级 VB 上机 操作