VB Question Where are the masters? vb Simple question

Updated on technology 2024-05-11
5 answers
  1. Anonymous users2024-02-10

    Do your homework yourself.

    Who knows why? Microsoft has decided so, is there a reason?

  2. Anonymous users2024-02-09

    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

  3. Anonymous users2024-02-08

    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:

  4. Anonymous users2024-02-07

    The bisecting search method is a more efficient search method. Suppose there are five integers a0 a4 that have been arranged in order from smallest to largest, and the number to be found is x, the basic idea is: Let the lower limit of the range of the search data be l=1, the upper limit is h=5, find the midpoint m=(l+h) 2, compare x with the midpoint element am, if x is equal to am, that is, find it, stop searching; Otherwise, if x is greater than am, replace the lower limit l=m+1 and continue to search in the lower half. If x is less than am, change the upper limit h=m-1 to the upper half of the search. Repeat the previous process until you find it or l>h.

    If l>h, it means that there is no such number, the printing cannot find the information, and the program ends.

    The solution in this problem:

    First round: the middle number is 172, because 172 < 178, so the lower limit of substitution is 175 Second round: the middle number is 177, because 177 < 178, so the lower limit of substitution is 177 The third round: direct search to get 178 = 178, the search is over.

    Therefore, the answer is C references.

  5. Anonymous users2024-02-06

    Of course, it's c, dichotomy, first find the middle term 172, 178 172, there are only three numbers left 178, 177, 175, and then find the middle term, 177, 178 177, and then only one item 178, 178 = 178, and you find it.

Related questions
3 answers2024-05-11

1. Solve all: Question 11 of the first picture.

1) Select C, event name. >>>More

6 answers2024-05-11

abs function: calculates the absolute value.

rnd function: Returns a single-precision number containing a random value. Without parameter, it is a decimal between 0 and 1. >>>More

6 answers2024-05-11

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

3 answers2024-05-11

Your first one is not a loop statement.

private sub form_click()if i = 0 then >>>More

6 answers2024-05-11

The second line declares that the textbox control array ** is wrong and does not conform to the syntax specification! >>>More