Home > Software engineering >  Of new, want to ask next my code, and where is wrong
Of new, want to ask next my code, and where is wrong

Time:09-21

Private Sub guanghua1 ()
Dim x1! , y1! %, x2, y2! As a Variant, j %, % b (42), I %
A=Array (86, 87, 82, 67, 61, 59, 86, 77, 76, 99, 108, 169, _
151, 243, 274, 347, 417, 547, 735, 814, 820, 1051, 1091, 1142, _
1127, 1012, 940, 810, 705, 593, 431, 346, 239, 192, 130, 95, 53, 32, 14, 11, 7)
Picture1. Cls
Picture1. DrawStyle=0
X1=200: y1=Picture1. ScaleHeight - 200
X2=Picture1. ScaleWidth - 200: y2=200
Picture1. Line (x1, y1) - (x2, y1) 'x
Picture1. Line (x1, y2) - (x1, y1) 'y
For j=1 To 42
B (j)=129 + I
Next j
For I=1 To 42
Picture1. PSet (b (I), a (I)), vbRed
Next I
In q: by the way, in the picture box on a given coordinate system type b (I), a (I) draw function image! I,,,,,, ahhh... want to for a long time,,,

CodePudding user response:

Ahhh a a a===for help

CodePudding user response:

For j=1 To 42
B (j)=129 + I
Next j
Which no assignment, I always=0, therefore, b (j)=129, all the time estimation problem right here,

CodePudding user response:

Option Base 1
This code inside some, I less to play up, sorry everyone a great god, and about the upstairs said I changed into j but show
Picture1. PSet (b (I), a (I)), vbRed
The subscript crossing the line

CodePudding user response:

refer To the second floor u013249970 response:
For j=1 To 42
B (j)=129 + I
Next j
Which no assignment, I always=0, therefore, b (j)=129, all the time estimation problem right here,

Ah, a great god I doubt is I write the function of print in coordinate interval has a problem,

CodePudding user response:

reference qq_33160636 reply: 3/f
subscript cross-border

you a members only 41! To cycle to 42!!!!!!
Subscript crossing the first check the array size,

CodePudding user response:

"More a less a" problem accounts for more than 10% of programmers often make mistakes!
Avoid "more a less a" problem is one of the methods of will like & lt; 10 even & lt; 5 generations into the program fragment, snapping fingers mental arithmetic test program should write to
X, x - 1, which of the x + 1?
<,<===, & gt; , & gt; Which of the=?

CodePudding user response:

CodePudding user response:

 For j=1 To 42 
B (j)=129 + I
Next j
For I=1 To 42
Picture1. PSet (b (I), a (I)), vbRed
Next I
"Is amended as:
For j=0 To 41
B (j)=129 + j
Next j
For I=0 To 41
Picture1. PSet (b (I), a (I)), vbRed
Next I

 a=Array (86, 87, 82, 67, 61, 59, 86, 77, 76, 99, 108, 169, _ 
151, 243, 274, 347, 417, 547, 735, 814, 820, 1051, 1091, 1142, _
1127, 1012, 940, 810, 705, 593, 431, 346, 239, 192, 130, 95, 53, 32, 14, 11, 7)
'a array is (0 To 41)
  • Related