TAILIEUCHUNG - Microsoft WSH and VBScript Programming for the Absolute Beginner Part 24

Microsoft WSH and VBScript Programming for the Absolute Beginner by Jerry Lee Ford Part 24. If you are new to programming with Microsoft WSH and VBScript and are looking for a solid introduction, this is the book for you. Developed by computer science professors, books in the for the absolute beginner series teach the principles of programming through simple game creation. You will acquire the skills that you need for more practical WSH and VBScript programming applications and will learn how these skills can be put to use in real-world scenarios. Best of all, by the time you finish this book,. | 210 Microsoft WSH and VBScript Programming for the Absolute Beginner Second Edition The Guess a Number Game Revisited So far you have seen examples of small pieces of code that work with functions and subroutines. Now let s take a look at how to apply procedures to a larger script. To begin take a moment to go back and review the Guess a Number game at the end of Chapter 6. This script like all other scripts earlier in this book was written without the use of procedures. As I deliberately avoided using procedures in the script from Chapter 6 I had to use other techniques for organizing the script s programming logic. What I chose to do was put everything in the script s main processing section as follows Added statements that generate a random number Added a loop that controls the game s execution Embedded an If statement within the loop that ensures that the player typed a number Embedded a second If statement within the previous If statement that makes sure that the data the player typed was numeric Embedded three more If statements within the previous If statement to determine whether the player s guess was low high or correct As you can see I had to embed a lot of statements within one another to organize the script into a workable game. As the script itself was not exceptionally large this was a manageable task. However had the script been much larger or more complex it would have been difficult to keep track of all the embedded logic. Now that you understand what procedures are and what they re used for let s take a moment and go back and redesign the Guess a Number game using them. One way of doing this is as follows Script Name Author Jerry Ford Created 11 29 02 Description This script plays a number-guessing game with the user Initialization Section Option Explicit Chapter 7 Using Procedures to Organize Scripts Const cGreetingMsg Pick a number between 1 - 100 Dim intUserNumber intRandomNo strOkToEnd intNoGuesses .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.