-
Record the corresponding English and Chinese translations in the two text files, read the data into the two variables, and then display them synchronously with the two label controls.
It's simpler and easier to maintain your data.
-
First look at button 1 event: The array a() is assigned a(0)=1 a(1)=2, a(2)=3, a(3)=4, a(4)=5
Let's start running the proc() program with array a() as an argument: Note that at the beginning, an i variable is declared, and static is added in front of it, because this static variable is declared in the function body, so this i is a static local variable, and the static local variable has the following characteristics:
1) Static local variables are defined within the function, but unlike automatic variables, they exist when they are called and disappear when they exit the function. A static local variable is always present, which means that it has a lifetime of the entire source program.
2) Although the lifetime of a static local variable is the entire source program, its scope is still the same as that of an automatic variable, that is, it can only be used in the function that defines the variable. After exiting the function, you cannot use the variable even though it continues to exist.
3) It is allowed to assign initial values to static local quantities of construction classes. If no initial value is assigned, the system will automatically assign the value. Numeric variables are automatically assigned an initial value of 0, and character-based variables are assigned an empty character.
In simple terms, the value of i will always exist in the function proc, its value will change as the program progresses, and this value is hereditary and will not be re-liquidated at the end of the program.
Obviously, in your program static i as integer defines a static local variable i because it is not explicitly initialized, so the initial value is 0
Next, dox(i) = x(i)+x(i+1).
i=i+1loop while i<2
Here, x(0)=x(0)+x(1) x(0) is assigned a value of 3
Then i+1=1 <2, so I did the cycle again: x(1)=x(1)+x(2) x(1)=5
At this point, i=2 does not do the loop, i.e. the result of the first proc(a) is 3 5 3 4 5
Note: The static local variable i has a value of 2 and will always exist.
Next, the second proc(a) is still the do loop program, and the program does it again because i = 2.
x(2)=x(2)+x(3) x(2)=7
i=i+1 i is 3
proc(a).
So the whole array is now a(0)=3, a(1)=5, a(2)=7, a(3)=4, a(4)=5 and the program ends.
To sum up, this program is the knowledge of static and do loop, and you can master it.
Of course, you can add another proc(a) and you will find that the result is 3, 5, 7, 9, 5
-
The i in the proc procedure is a static variable with an initial value of 0, which is retained for the rest of the execution and after the end of the procedure, and will continue to be valid for the next call.
When the command button is clicked, the value of the array a(0) a(4) is: 1 5
call is a command that invokes the procedure.
After the first call, the value of the a-array becomes.
The value of i becomes 2.
On the second call, the loop body is executed once, a(2) = a(2) + a(3), so the value of the a array becomes:
-
The answer is 35, and the answer is attached to the results of the execution of the program. Filial piety.
Asking for the same data every time you run, so what's the point of asking for a text box? Or did you not make it clear? Isn't it just static, isn't it just when the text attribute is set? >>>More
Your ** is not good in itself, move slowly Unless it is directX programming, in other cases, please use timer instead of directly using loops, otherwise the CPU usage will be very high. >>>More
Your first one is not a loop statement.
private sub form_click()if i = 0 then >>>More
mid(string a, start looking for the bit value (data b), find the number of digits (data c)) Your function looks like this. >>>More
The second line declares that the textbox control array ** is wrong and does not conform to the syntax specification! >>>More