《VB程序设计基础》习题答案Word格式文档下载.docx

上传人:b****3 文档编号:8315774 上传时间:2023-05-11 格式:DOCX 页数:18 大小:62.36KB
下载 相关 举报
《VB程序设计基础》习题答案Word格式文档下载.docx_第1页
第1页 / 共18页
《VB程序设计基础》习题答案Word格式文档下载.docx_第2页
第2页 / 共18页
《VB程序设计基础》习题答案Word格式文档下载.docx_第3页
第3页 / 共18页
《VB程序设计基础》习题答案Word格式文档下载.docx_第4页
第4页 / 共18页
《VB程序设计基础》习题答案Word格式文档下载.docx_第5页
第5页 / 共18页
《VB程序设计基础》习题答案Word格式文档下载.docx_第6页
第6页 / 共18页
《VB程序设计基础》习题答案Word格式文档下载.docx_第7页
第7页 / 共18页
《VB程序设计基础》习题答案Word格式文档下载.docx_第8页
第8页 / 共18页
《VB程序设计基础》习题答案Word格式文档下载.docx_第9页
第9页 / 共18页
《VB程序设计基础》习题答案Word格式文档下载.docx_第10页
第10页 / 共18页
《VB程序设计基础》习题答案Word格式文档下载.docx_第11页
第11页 / 共18页
《VB程序设计基础》习题答案Word格式文档下载.docx_第12页
第12页 / 共18页
《VB程序设计基础》习题答案Word格式文档下载.docx_第13页
第13页 / 共18页
《VB程序设计基础》习题答案Word格式文档下载.docx_第14页
第14页 / 共18页
《VB程序设计基础》习题答案Word格式文档下载.docx_第15页
第15页 / 共18页
《VB程序设计基础》习题答案Word格式文档下载.docx_第16页
第16页 / 共18页
《VB程序设计基础》习题答案Word格式文档下载.docx_第17页
第17页 / 共18页
《VB程序设计基础》习题答案Word格式文档下载.docx_第18页
第18页 / 共18页
亲,该文档总共18页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

《VB程序设计基础》习题答案Word格式文档下载.docx

《《VB程序设计基础》习题答案Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《《VB程序设计基础》习题答案Word格式文档下载.docx(18页珍藏版)》请在冰点文库上搜索。

《VB程序设计基础》习题答案Word格式文档下载.docx

14,A 

15,D

16,B 

17,B 

18,C 

19,B 

20,B

21,B 

22,D 

23,A 

24,C 

25,B

26,A 

27,D 

28,B 

三,简答题

1.

(1)2*Cos(alfa)*Sin(alfa/(2*a)

(2)Sqr(s*(s–a)*(s–b)*(s-c))

(3)(A^2+B*C*(X+Y))/(A+B)

(4)(2*3.14159*r+Exp(-5))*Log(x)

(5)1/(x+1/(y+1))

(6)k/(1+a*Exp(-b*x))

(7)5+6*x/(3*(x^2-1)-2*x)

(8)Sqr(y^3+3*(a^2+b^2)/(x^2+y^2))

2.

(1)(a+b)Modc

(2)Sqr(Abs(x))

(3)Int(x)+1(4)Int(Rnd*101)+200

3.PrivateSubForm_Click()

DimaAsInteger,bAsInteger

DimcAsInteger,yAsLong

a=InputBox("

请输入a的值"

b=InputBox("

请输入b的值"

c=InputBox("

请输入c的值"

y=a^2+2*b^2+2*c^2

Print"

y="

;

y

4。

(1) 

(2)T 

(3)F 

(4) 

T

5.

(1)1<

=xAndx<

12

(2)T+3<

>

V-2And(T+V)>

100

(3)(a+b)>

=cor(a-c)<

=c

(4)a>

0AndInt(a)=aAndb>

0AndInt(b)=bora<

0Andb<

(5)x<

=yOrx>

=z

(6)a=0Andb<

0ora<

0Andb=0

四,编程题

1.PrivateSubForm_Click()

DimaAsInteger,bAsInteger

DimcAsInteger,yAsSingle

请输入正整数a的值"

请输入正整数b的值"

请输入正整数c的值"

y=(a+b+c)/3

Print"

平均值y="

2.PrivateSubForm_Click()

DimrAsInteger,sAsSingle

ConstPi=3.14159

r=InputBox("

输入圆半径"

"

输入"

10)

s=Pi*r*r

MsgBox"

圆面积Area="

&

Str(s)

P78习题三

一, 

3,B 

5,C

二, 

1, 

37,55,64,28,19

2, 

y=KIGECA

3, 

1

121

12321

4, 

cHINA!

三, 

As 

Double

s=1

Abs(t)>

=1e-5

s=s+t

2, 

s+c

-1

s

3, 

m=n

mTon

Sum=Sum+j

Sum=i

四,1,

PrivateSubForm_Click()

DimxAsSingle,fAsSingle

x=InputBox("

输入x:

"

Ifx<

-5Then

f=3*x*x+2*x-1

ElseIfx<

=5Then

f=x*Sin(x)+2^x

Else

f=Sqr(x-5)+Log(x)/Log(10)

EndIf

Label1.Caption=f

2.

DimiAsInteger,flagAsInteger

DimtAsDouble,yAsDouble

y=0

flag=1

t=0.5

i=1

WhileAbs(t)>

=0.00001

t=1/i/(i+1)

y=y+flag*t

flag=-flag

i=i+1

Wend

Print"

y="

Y=0.5669

3.

DimnAsInteger,iAsInteger,flagAsInteger,sAsSingle,tAsInteger

n=InputBox("

请输入n的值:

"

sum=0

t=1

flag=-1

Fori=1Ton

t=t*i

s=s+flag*i/t

Nexti

s="

4.

PrivateSubCommand1_Click()

Fori=1To9

Forj=1Toi

Printi;

*"

j;

="

i*j;

Nextj

Print

5.

Fori=1To5

PrintTab(6-i);

Forj=1To2*i-1

Fori=4To1Step-1

P104练习四

一、单选题

1,D2,C3,C4,C5,D

二、程序阅读题

1,12109

2,0

1

123

2

3、div=3

三、程序填空题

1、

Len(str1)

Mid(str1,i,1)

p=j

i<

p

2、

l=Len(St$)

a(i)=Mid(St$,i,1)

p=s-96

x(p)=x(p)+1

3、

a(1To4,1To5)

s=0

a(i,5)=s/4

四、程序设计题

1.

Dima(50)AsInteger

Fori=1To50

a(i)=Int(Rnd*71)+30

Printa(i);

IfiMod5=0ThenPrint

Min=a

(1):

Max=a

(1):

Fori=2To50

IfMin>

a(i)ThenMin=a(i)

IfMax<

a(i)ThenMax=a(i)

s=s+a(i)

max="

Max,"

min="

Min,"

average="

s/50

DimmaxAsInteger,minAsInteger

Dima()AsInteger

n=Val(InputBox("

))

ReDima(n)AsInteger

a(i)=Int(Rnd*100)

Ifa(i)Mod2=0Thenmin=a(i)Elsemax=a(i)

Ifmin<

0Andmax<

0ThenExitFor

Ifa(i)Mod2=0Andmin>

a(i)Then

min=a(i)

ElseIfa(i)Mod2=1Andmax<

max=a(i)

EndIf

max,"

min

冒泡法:

Dima(10)AsInteger

Fori=1To10

a(i)=Int(Rnd*90)+10

Forj=1To10-i

Ifa(j)<

a(j+1)Thent=a(j):

a(j)=a(j+1):

a(j+1)=t

选择法:

Forj=i+1To10

Ifa(i)<

a(j)Thent=a(i):

a(i)=a(j):

a(j)=t

4、

Dima(20)AsInteger,score(5)AsInteger

Fori=1To20

a(i)=Int(Rnd*101)

Ifa(i)>

=90Then

score

(1)=score

(1)+1

ElseIfa(i)>

=80Then

score

(2)=score

(2)+1

ElseIfa(i)>

=70Then

score(3)=score(3)+1

=60Then

score(4)=score(4)+1

score(5)=score(5)+1

Printscore(i)

P126练习五

一.对:

1,2,3,4,6,7,9

错:

5,8

二.1,D2,C3,A4,B5,D6,?

7,?

8,D

三.

1,

1)a()AsSingle,mAsInteger

2)j=i+1Tom

3)a(i)<

a(j)

4)Callpf(b,n)

2,

1)Int(Rnd*21)+30

2)Forj=i+1To10

3)CallSwap(a(i),a(j))

4)a(10)

3,

1)IfIsprime(i)=TrueAndIsprime(x-i)=TrueThen

2)Isprime=True

3)IfxModi=0Then

四,

1.976

2,4

-9

3,646

483642

4,26

9

五、

Dima()AsSingle,nAsInteger,sAsSingle

DimvAsSingle,iAsInteger

n=InputBox("

请输入n的值"

ReDima(n)

Fori=1Ton

a(i)=InputBox("

Nexti

v=f(a,n)

s=s+(a(i)-v)^2

s=Sqr(s)/n

Prints

PrivateFunctionfsum(a()AsSingle,nAsInteger)AsSingle

DimiAsInteger

fsum=fsum+a(i)

EndFunction

PrivateSubff(x()AsSingle,mAsByte,nAsByte,xmaxAsSingle,kiAsByte,kjAsByte)

DimiAsInteger,jAsInteger

xmax=x(1,1):

ki=1:

kj=1

Fori=1Tom

Forj=1Ton

Ifx(i,j)>

xmaxThenxmax=x(i,j):

ki=i:

kj=j

P153练习六

一,

对:

5

错:

1,2,3,4,6,7,8,9,10

二.

1,D2,D3,题目有错(应改为True)A4,C5,C

6,D7,C8,D9,与2重复10,C

11,B12,B13,B14,B

1.

(1)DimaAsInteger,bAsInteger

(2)Str(n)+Str(n_error)

(3)KeyPress

(4)KeyAscii<

13

(5)Command1.Enabled=True

2.

(1)1To2*i–1

(2)Command2.Enabled=True

(3)Command2.Enabled=False

四.

1.GFEDCBA

2.小,你好!

小李,你好!

3.您好

欢迎使用VisualBasic!

五.

1.

PrivateSubCommand1_Click(IndexAsInteger)

DimyAsSingle

SelectCaseIndex

Case0

y=Val(Text1.Text)+Val(Text2.Text)

Label4.Caption=Text1.Text+"

+"

+Text2.Text+"

+Str(y)

Case1

y=Val(Text1.Text)-Val(Text2.Text)

-"

Case2

y=Val(Text1.Text)*Val(Text2.Text)

Case3

y=Val(Text1.Text)/Val(Text2.Text)

/"

EndSelect

PrivateSubForm_Load()

Text1.Text="

Text2.Text="

Label1.Caption="

数一"

Label2.Caption="

数二"

Label3.Caption="

结果表达式:

Label4.Caption="

Command1(0).Caption="

加"

Command1

(1).Caption="

减"

Command1

(2).Caption="

乘"

Command1(3).Caption="

除"

PrivateSubText1_KeyPress(KeyAsciiAsInteger)

IfKeyAscii<

Asc("

0"

)OrKeyAscii>

9"

)Then'

判断为非数字键

KeyAscii=0'

改变键入文本框的显示为空字符,即不显示

EndIf

PrivateSubText2_KeyPress(KeyAsciiAsInteger)

)Then

KeyAscii=0

P176练习七

一,

对:

2,4,5,6,9,10

1,3,7,8

二,

1,B2,C3,D4,C5,B6,D7,A8,A9,D

三,

(1)List3.Clear

(2)List1.ListCount–1

(3)List2.ListCount–1

(4)ExitFor

(5)j<

List2.ListCount

(1)Timer1_Timer

(2)Label1.Left=-Label1.Width

1,

(1)C

(2)A(3)C

2,

(1)B

(2)D(3)D(4)D

3,y=6

y=14

4,

(1)A

(2)A(3)B(4)D

5,n=4

n=12

n=28

6,

7,上海

乌鲁木齐

浙江杭州

北京

P207练习八

1,2,7

3,4,5,6,8,9

1,A2,D3,C4,B5,C

6,D7,C8,D9,D10,C

(1)ScaleMode=6

(2)Scale(-ScaleWidth/2,ScaleHeight/2)-(ScaleWidth/2,-ScaleHeight/2)

(3)Circle(0,0),30,,-3.14159*4/3,-3.14159*2

(1)Picture1.FillStyle=0

(2)-2*PI,-a*x

(3)vbBlue

(4)K<

)OrK>

(1)b=Picture1.Point(x,y)

(2)r=Int(cMod256)

(3)Nextj,I

2.

3.

4.

月亮环饶太阳转

P234练习九

1,A2,B3,C4,D5,B6,B7,A

1,m1.Visible=FalseFalse

CommonDialog1.ColorCommonDialog1.FontItalicPopupMenum1,2

2,StaticiAsIntegerButton=1

P251练习十

1,B2,D3,A4,B5,B

NO13

NO24

NO37

NO411

NO518

三、

1.list1.clear

input#1,n

prime(nasinteger)asboolean

2.Filter=“文本文件|*.txt”

noteof

(1)

四、

Open"

g:

\myfile1.txt"

ForInputAs#1

\myfile2.txt"

ForOutputAs#2

DoWhileNotEOF

(1)

Input#1,c$,n1%,n2%,n3%

Sum%=n1%+n2%+n3%

ave%=Sum/3

Write#2,c$,n1%,n2%,n3%,Sum%,ave%

Loop

Close

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 解决方案 > 其它

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2