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

Microsoft WSH and VBScript Programming for the Absolute Beginner by Jerry Lee Ford Part 22. 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,. | Microsoft WSH and VBScript Programming for the Absolute Beginner Second Edition Main Processing Section Generate a random number Randomize intRandomNo FormatNumber Int 100 Rnd 1 Loop until either the user guesses correctly or the user clicks on Cancel Do Until strOkToEnd yes Prompt user to pick a number intUserNumber InputBox Type your guess cGreetingMsg intNoGuesses intNoGuesses 1 See if the user provided an answer If Len intUserNumber 0 Then Make sure that the player typed a number If IsNumeric intUserNumber True Then Test to see if the user s guess was correct If FormatNumber intUserNumber intRandomNo Then MsgBox Congratulations You guessed it. The number was _ intUserNumber . vbCrLf vbCrLf You guessed it _ in intNoGuesses guesses. cGreetingMsg strOkToEnd yes End If Test to see if the user s guess was too low If FormatNumber intUserNumber intRandomNo Then MsgBox Your guess was too low. Try again cGreetingMsg strOkToEnd no End If Test to see if the user s guess was too high If FormatNumber intUserNumber intRandomNo Then MsgBox Your guess was too high. Try again cGreetingMsg strOkToEnd no End If Chapter 6 Processing Collections of Data Else MsgBox Sorry. You did not enter a number. Try again. cGreetingMsg End If Else MsgBox You either failed to type a value or you clicked on Cancel. Please play again soon cGreetingMsg strOkToEnd yes End If Loop Okay it s time to run the script and see whether it works as promised don t worry it will . After testing to see whether the script works as expected retest it to see whether you can break it. For example try feeding it special characters or letters instead of numbers. Once you re satisfied with the operation of the script keep reading. I have one more little goodie for you in this chapter. Creating Shortcuts for Your Game Up until now you have been running your scripts in one of two ways. One is by opening the Windows Command Console and typing in the name of an execution host followed by the path and filename of your .

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.