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

Microsoft WSH and VBScript Programming for the Absolute Beginner by Jerry Lee Ford Part 19. 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 Dim objWshShell strAnswer strCardlmage strResults intGetRandomNumber Set objWshShell strResults None Prompt the user to select a choice strAnswer InputBoxCPlease type Paper Rock or Scissors. _ vbCrLf vbCrLf Rules vbCrLf vbCrLf _ 1. Guess the same thing as the computer to tie. vbCrLf _ 2. Paper covers rock and wins. vbCrLf _ 3. Rock break scissors and wins. vbCrLf _ 4. Scissors cut paper and win. vbCrLf Let s play a game Time for the computer to randomly pick a choice Randomize intGetRandomNumber Round FormatNumber Int 3 Rnd 1 If intGetRandomNumber 3 then strCardlmage rock If intGetRandomNumber 2 then strCardlmage scissors If intGetRandomNumber 1 then strCardlmage paper Select Case strAnswer Case rock If intGetRandomNumber 3 Then strResults Tie If intGetRandomNumber 2 Then strResults You Win If intGetRandomNumber 1 Then strResults You Lose Case scissors If intGetRandomNumber 3 Then strResults You Lose If intGetRandomNumber 2 Then strResults Tie If intGetRandomNumber 1 Then strResults You Win Case paper If intGetRandomNumber 3 Then strResults You Win If intGetRandomNumber 2 Then strResults You Lose If intGetRandomNumber 1 Then strResults Tie Case Else Sorry. Your answer was not recognized. Chapter 5 Conditional Logic Please type rock paper or scissors in all lowercase letters. End Select You picked space 12 strAnswer vbCrLf _ vbCrLf Computer picked space 2 strCardlmage vbCrLf vbCrLf vbCrLf vbCrLf Results _ strResults Performing More Complex Tests with VBScript Operators Up to this point in the book every example of the If or a Sel ect Case statement that you have seen has involved a single type of comparison equality. This is a powerful form of comparison but there will be times when your scripts will need to test for a wider range of values. For example suppose you wanted to write a script that asked the

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.