VB Programming Guess the Size, VB Programming Guess the Number Game

Updated on educate 2024-05-25
13 answers
  1. Anonymous users2024-02-11

    dim i as integer

    dim s as integer

    private sub cmd1_click()s = 0randomize

    i = (rnd * 99) +1

    falsefalse

    trueend sub

    private sub cmd2_click()s = s + 1

    if val( >i then

    "Big, you've already guessed" & s & "times"

    elseif val( = & "It's small, you've already guessed" & s & "times"

    Congratulations"end if

    end sub

  2. Anonymous users2024-02-10

    dim a as byte

    dim b as byte 'Number of carriage returns.

    private sub command1_click()randomize

    a = int(rnd * 100 + 1)= false

    b = 0end sub

    private sub text1_keypress(keyascii as integer)

    if keyascii = 13 and = false thenif b = 10 then

    Bad luck! Please re-ask the question! "

    falsetrueexit sub

    end if

    if val( = a then

    true "Correct"

    elseif val( "Too small"b = b + 1

    elseif val( >a then

    Too big"b = b + 1

    end if

    end if

    end sub

  3. Anonymous users2024-02-09

    Just write the judgment ** of if times<4 into the condition when the input is correct.

  4. Anonymous users2024-02-08

    dim a as byte

    dim b as byte 'Number of carriage returns.

    private sub command1_click()randomize

    a = int(rnd * 100 + 1)= false

    b = 0end subprivate sub text1_keypress(keyascii as integer)

    if keyascii = 13 and = false thenif b = 10 then

    Bad luck! Please re-ask the question! "

    falsetrueexit sub

    end if

    if val( = a then

    true "Correct"

    elseif val( "Too small"b = b + 1

    elseif val( >a then

    Too big"b = b + 1

    end if

    end if

    end sub

  5. Anonymous users2024-02-07

    What are the events used for?

    private sub command5_click()dim b(10) as integer, irandomize

    for i = 1 to 10

    b(i) = int(rnd * 99 - 10 + 1) +10)

    next i

    call bnim(b())

    end sub

    private sub bnim(byref a() as integer)

    dim i, j as integer

    j = a(1)

    for i = 1 to 10

    if j > a(i) then

    j = a(i)

    end if

    next i

    print j

    end sub

    The control I use is command, and the event is click, you can see for yourself.

  6. Anonymous users2024-02-06

    private b(10) as integer 'Array b'Generate random numbers.

    private sub command1_click()for i = 0 to 9

    b(i) = int(rnd * 99 - 10 + 1)) 10

    next i

    end sub

    Outputs all values in array b.

    private sub command2_click()if b(0) = 0 then

    msgbox ("Mr. Random number, please")

    exit sub

    end if

    for i = 0 to 9

    b(i))next i

    end sub

    Displays the minimum value.

    private sub command3_click()= getminvalue(b)

    end sub

    Get the minimum subfunction.

    private function getminvalue(x() as integer) as integer

    dim y as integer

    y = x(0)

    if b(0) = 0 then

    msgbox ("Mr. Random number, please")

    exit function

    end if

    for i = 0 to ubound(x) -1y = iif(y < x(i), y, x(i))next i

    getminvalue = y

    end function

  7. Anonymous users2024-02-05

    Object-oriented programming is characterized by: encapsulation, inheritance, and polymorphism.

    Everything is an object, and its three elements are: attributes, methods, and events.

    An event-driven mechanism that uses events (e.g., mouse click, keyboard key press) to achieve a series of actions.

  8. Anonymous users2024-02-04

    I don't quite understand the meaning of LZ, VB design is quick to start, and it is difficult to go deeper.

  9. Anonymous users2024-02-03

    Visual Basic programming is the basic programming language.

    With a graphical user interface (GUI) and rapid application development (RAD) system, VB can easily connect to databases using DAO, RDO, ADO, or easily create Active X controls for efficient generation of type-safe and object-oriented applications.

    Programmers can easily build an application quickly using the components provided by VB.

  10. Anonymous users2024-02-02

    VB programming is a Visual Basic programming language, and computer programming languages are required to write computer programs. Computer programming languages are the bridge between people and computers, and there are many computer programming languages.

    At present, the most widely used languages are "C++", "Pascal", "Basic", etc. Among the many computer programming languages, the basic language is the easiest to learn and use.

    Basic is the abbreviation of Beginner's All Purpose Symbolic Instruction Code, which means universal symbolic instruction for beginners**, and has always been the preferred language for getting started with programming.

    In 1991, Visual Basic (VB) was launched, which is the third generation of BASIC, which not only inherits the advantages of BASIC language that is easy to learn and use, but also adds graphical interface design tools.

    VB programming can design most of the software on the Windows platform, but some software can be done, but it is not suitable for VB programming.

    For example, if you use VB to make a game, it is feasible in principle, and there are people who have developed games with VB, but I have to say that it is too troublesome. There are also some low-level control programs that are not easy to do.

    At present, the main use of VB is still to quickly create less complex, small desktop software. So if you want to develop large-scale software, such as Photoshop or 3DMax, VB is obviously not up to the task.

    1. The basic characteristics of VB.

    1) Visual design platform. Visual Basic provides a visual design platform that "encapsulates" the complexity of Windows interface design, so that developers don't have to write a lot of programs for interface design**.

    Just follow the design requirements and draw various objects on the screen with the tools prompted by the system. Visual Basic automatically generates interface design, and the programmer only needs to implement the part of the program function, which greatly improves the efficiency of program design.

    2) Event-driven programming mechanism. VB does not have a main program in the traditional sense, and the basic method of program execution is to drive the operation of subroutines by "events". In a graphical user interface application, it is the user's actions, i.e., events, that control the flow of the program.

    Each event drives the running of a program. The programmer only needs to write the ** that responds to the user's actions, and there is not necessarily a connection between the individual actions, making the program both easy to write and easy to maintain.

    2. Advantages of VB.

    1) Powerful numeric and string processing functions.

    2) Abundant graphical instructions.

    3) Provide static and dynamic arrays, which is conducive to simplifying memory management.

    4) Procedures can be called recursively.

    5) Support random file and sequential file access.

    6) Provides a library of icons with multiple types that can be called by the program.

    7) It has perfect operation error handling.

  11. Anonymous users2024-02-01

    Visual Basic is a Windows application development tool launched by Microsoft. Because it is easy to learn, easy to operate, and powerful, it has become the preferred programming language for ordinary users.

    In our country, the Chinese version is quite popular. In order to meet the needs of the development of the situation, computer majors and non-computer majors in colleges and universities have set up VB application design courses.

    Visual Basic inherits the advantages of the basic language and adds many new functions, it adopts object-oriented and event-driven programming ideas, making programming more convenient and faster. Visual Basic allows you to develop small tools for individual or group use, as well as large software such as multi-software, database applications, and web applications.

    It is one of the most popular programming languages at home and abroad. In practice, we need to import the collected data or information into the database to make the data management more convenient, and we may also need to add, modify, and delete data from the database and save it in the form of text or electronic documents.

    Visual adopts a visual programming method, and tasks such as interface design, writing and debugging of applications are completed in the integrated development environment of Visual Basic.

  12. Anonymous users2024-01-31

    1. VB programming takes Visual Basic Chinese Simplified Chinese version as the language background, introduces Visual Basic programming technology in simple terms, and basically covers the common content of Visual Basic programming.

    2. VB programming is divided into 14 chapters, including development environment, language basics, arrays and processes, common controls, menu design, file processing, ActiveX controls, database programming, graphic programming, multi-** programming, network programming, API functions and registry, installation program production and comprehensive examples.

    3. In order to facilitate readers' learning, "VB Programming" provides multiple courseware, as well as all sources of example questions and practice questions.

    4. VB programming can be used as a textbook for computer and related majors in colleges and universities, and is suitable for self-learning by programming enthusiasts.

  13. Anonymous users2024-01-30

    It is a programming language in Visual Basic.

    Visual Basic is a structured, modular, object-oriented, event-driven programming language developed by Microsoft that includes an event-driven mechanism to assist in the development environment. This is a language that can be used for Microsoft's own product development. It is derived from the basic programming language.

    Visual Basic (VB) is a general-purpose object-based programming language developed by Microsoft, which is a structured, modular, object-oriented, event-driven visual programming language that includes an event-driven mechanism to assist the development environment. is a language that can be used in Microsoft's own product development.

Related questions
4 answers2024-05-25

Simple! 1. Define the array a(4,4).

2. In the loop, use int(240+rnd(325-240)) to generate random numbers and assign them to an array, and judge whether it is less than 300, when it is less than 300, add up, and record the number. >>>More

6 answers2024-05-25

VB design.

Introduction. What is required. >>>More

17 answers2024-05-25

Not popular, but much easier to learn than other languages.

6 answers2024-05-25

Add 2 buttons, 2 textboxes, 1 listbox, and you can't go wrong. >>>More

7 answers2024-05-25

The last sentence is wrong, you have already swapped the values of the original b and c in the second if sentence, which means that the value of a must be greater than the value of c, and at this time, the value of a is not necessarily greater than the value of b, so this is not good.