C++ Programming for Games Module I phần 5

Tham khảo tài liệu 'c++ programming for games module i phần 5', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 7 ln x 8 eAx 9 x 10 floor x 11 ceil x 12 Enter x ceil x 12 1 cos x 2 sin x 3 tan x 4 atan2 y x 5 sqrt x 6 xAy 7 ln x 8 eAx 9 x 10 floor x 11 ceil x 12 Exiting. Press any key to continue Slot Machine Implement a function that returns a random integer in the range low high where low and high are input parameters. The function prototype should look like this int Random int low int high Be sure to verify that your function implementation works by testing it. Using your Random function write a virtual slot machine program. The program should start the player off with and should display a menu like this Player s chips 1000 1 Play slot. 2 Exit. If the player enters 1 the program should ask the user to enter in his or her bet. The program needs to verify that a legal bet was placed that is a bet greater than zero and less than or equal to the amount of money the player has. After the player has input his or her bet the program must calculate three random numbers in the range 2 7 and output them neatly to the screen. If all three numbers are sevens then the player wins ten times their betting money else if the three numbers are all the same but not sevens then the player wins five times their betting money else if two out of the three numbers are the same then the player wins three times their betting money else the player loses his or her bet. At this point calculate the player s new chip amount and redisplay the menu. If at any point the player loses all of his or her chips a message should be displayed to the player and the program should exit. Also if the player enters 2 from the menu then the program should exit. Here is an example of what the output should look like Player s chips 1000 1 Play slot. 2 Exit. 1 Enter your bet 1500 You did not enter a valid bet. Enter your bet 1000 3 3 7 You win Player s chips 3000 1 Play slot. 2 Exit. 2 Exiting. 101 Binary Search Background Information In the exercises of the previous chapter we .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
144    294    52    14-05-2024
Đã 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.