aver = 0 - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

aver = 0

Description:

2 VB6.0 Dim a() As Variant, b() As Variant, i% a = Array(1, 2, 3, 4, 5) ReDim ... – PowerPoint PPT presentation

Number of Views:68
Avg rating:3.0/5.0
Slides: 19
Provided by: WJ61
Category:
Tags: aver | vb60

less

Transcript and Presenter's Notes

Title: aver = 0


1
??? ??(4??)
  • 5.1 ?????
  • 5.2 ???????
  • 5.3 ???????
  • 5.4 ???????
  • 5.5 ????
  • 5.6 ???????
  • 5.7 ????(?)
  • 5.8 ????

2
?? ????? 1.?? ?5.1????????100????????,????????????
? ??????????????????,?????????? aver 0
For i 1 To 100 mark
InputBox("??" i "??????") aver
aver mark Next i aver aver /
100 ?????????????,??????mark???????,??????????????
???????????????,?????? (1)????????????
(2)?????????????,?????????? ??????????,????,??????
???,????,?????

3
  • ???????
  • ???????????,??????????????????????????
  • ???? ??(??)?????(???)??
  • 1. ???????
  • ?? Dim ???(??1,??2) As ??
  • ????????????????
  • ???????????,??60??
  • ?? ?? To ?? ?????0 ,??????
  • ????? ??-??1
  • ???? ????????
  • ?Dim mark(1 to 100) As Integer

4
Dim lArray( 0 To 3, 0 To 4) As Long ??
45??? ??? Dim lArray(3, 4) As Long
?? (1) ?????0 ,??????????????? Option Base
1 (2)?????,????? n
Inputbox(??n) Dim x(n) As Single
(3)?????????????????,???????
???????????????????????? ????????,?????? ??
Dim x(10) As Integer ' ???x???11??? x(10)100
' ?x(10)????????
5
????????? ???????????????????(????????),????
?? ???ReDim??????????? ???? ReDim
???(??,??2) As ?? ? Sub Form_Load(
) Dim sArray( ) As Single
ReDim
sArray(4,8)
End Sub ?? (1) Dim?Private?Public???????????
?,?????????????ReDim???????,????????? (2)
?????????ReDim????????,?????????. (3)
????ReDim??????????????,???ReDim????Preserve??????
??????,???Preserve???????????,????????????5.2,????
??????? (4) ReDim?????????,?????????????
6
????????? 1. ???????? (1)???
For i 1 To 10 iA(i)0 Next
i
(2) Array?? Dim ib As Variant ib
Array("abc", "def", "67") For i 0 To
UBound(ib) Picture1.Print ib(i) " "
Next i
?? (1)??Array????????,??????????????????,????
????Variant? (2)???????,???Array?????????????
,??????Ubound???
7
2.????? ?VB6.0?,???????????????? Dim a() As
Variant, b() As Variant, i a Array(1, 2, 3,
4, 5) ReDim b(UBound(a)) b a 3.
????? ????sC??????? For i 0 To 4 For j
0 To i sc(i, j) i 5 j
Print sc(i, j) " " Next j
Print ' ?? Next I
For i 0 To UBound(a) b(i) a(i) Next i
???????????????Variant???????????
8
4. ????????????? Dim Max As Integer,iMax As
Integer MaxiA(1)iMax1 For i 2 To
10 If iA(i)gtMax Then MaxiA(i) iMaxi
End If Next I 5. ????????? For i
1 To 10\2 tiA(i) iA(i)iA(10-i1)
iA(10-i1)t Next I
9
  • ?. ????
  • ???????????? ?????????,???????,???????????????
    ????(Index)?
  • ?????????????,?????????????????????
  • ? Private Sub cmdName _Click(Index As
    Integer)
  • If Index3 then
  • ????????????
  • End If
  • End Sub
  • 1.??????????
  • ????????,??????,??????????
  • ?????,??Copy??????Paste??????? ??????????
  • ??????????

10
?5. 3 ???????????????,?????????,???????????????
Private Sub Command1_Click(Index As Integer)
Select Case Index Case 0
"???" Case 1
"???" Case 2 ??
Case Else End
End Select End Sub
11
  • 2.?????????
  • ???????
  • ?????????,??????Index??0,????????,??????????
  • ??????Load????????????,?????Unload????????????
  • ????????????Left?Top???????????,??Visible
    ?????True?

?5.4 ????????????,???????????
?????,???????,????????????
12
????????? ???????????????C????????Pascal???????
1.???????? ???? Type ?????? ???(??)
As ??? ???(??) As ??? End Type
????????????????????? Type StudType
No As Integer ' ?? Name As String
20 ' ?? Sex As String 1 ' ??
Mark(1 To 4) As Single ' 4?????
Total As Single ' ?? End Type
????????????????? ???????? ?????????
13
?? (1)????????????(.BAS)???,???Public??????Pri
vate? (2)?????????????????,?????????
(3)???????????????????,???????Integer?Single?????,
??VB????????????????,????? (4)??????????????,???
????? 2.????????????? (1) ????
Dim ??? As ?????? ? Dim
Student As StudType (2) ??
?????.??? ? ??Student??????,?4??????
,????? Student.Name,Student.Mark(4) 3.????????
?? ?5.5 ?????????,????????(????????)????
14
??????(?) 1. ?? ?5.6??????,??????????,?????????
?? 1.??26????????,???????26??????,??????????????,
???????????????? 2.??????????????,???????(???????
?),????? 3.????
For I 1 To le c UCase(Mid(Text1, I, 1))
If c gt "A" And c lt "Z" Then j Asc(c) -
65 1 a(j) a(j) 1
End If Next I
15
2.??????? ?5.7????????,???????????????????????????
???????? ?? (1)????????????,??????????
(2)??????Rplace???????????? (3)???Split????????
,????? (4)????Join??????????????????
16
3.???? ?5.8 ??????????n??,???????????? (1)
?n????????????(??),??1??????
(2)??1???,??n-1????(1)?????????,??2??????
(3)??(1)n-1?,????????? For i 1 To n -
1 iMin i For j
i1 To n If iA(j) lt iA(iMin)
Then iMin j Next j
t iA(i) iA(i) iA(iMin) iA(iMin) t
Next I
17
4.?????????? (1) ?? ?5.10 ?????a(1 to
n)(??n-1???)?????Key??,??
????????k(1ltkltn-1) ????,???????????K????
??????? ?k????????,?????Key??

(2) ?? ????????????????k???k1?n?????????????
????1?
18
??????????????
1.???????????? n InputBox("???????") Dim
a(1 To n) As Integer 2.??????
???????????????????? Dim a(1 To 30) As
Long, i a(1) 1 a(2) 1 For i 3
To 30 a(i) a(i - 2) a(i
- 1) Next I 3.????? ????????????????????
??? Dim a(3, 5) As Long
a(I)10 4.Aarry?????? ???Variant
??????????? 5.?????????? UBound ?Lbound??
Write a Comment
User Comments (0)
About PowerShow.com