Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A Computer Slot Machine- C PROGRAMMING The project in this assignment is to build a text-only (pseudovideo) slot machine. A slot machine has 3 wheels..

A Computer Slot Machine- C PROGRAMMING

The project in this assignment is to build a text-only (pseudovideo) slot machine. A slot machine has 3 wheels.. During play, each wheel spins independently and comes to stop with one of its "pictures" showing in a window. The player wins if all three words are the same.

This assignment is best solved by writing several little functions, where each function performs a small task in a bigger plan. You will simulate the spinning of the wheel your game will use a random number. Each integer value represents one of the possible images. To show the state of one wheel, your game should print the name of the image associated with that number. The show the complete state of the machine, your game should print all three wheels, one after the other on the same line. If the player wins, your game should print the three image names (all the same) followed by the words YOU WIN! Playing the game means selecting the three random numbers and displaying the three images, either as a losing game, or as a winning game. Your game should make it easy for the player to play the same machine over and over again. All they have to do is hit the enter key.

So your main should display only one prompt, and play the game each time the user hits enter. If the user types anything other than enter, and then enter, exit the loop and stop play. The six underlined functions, as mentioned above in order, perform the following tasks:

1) randomBetween()

return a random integer between an upper and lower bound passed as arguments,

2) printImage()

print the name of an image when passed its number as an argument

3) printGame()

call the print image function three times, once for each wheel

4) printWinningGame()

do the same thing as 3, only in a way to represent winning (with all three images the same)

5) playGame()

play the game by getting three random values for the three images and calling either the winning or non-winning display functions,

6) main()

initialize the random number generator, prompt the user, and loop as long as the user hits nothing but enter

For this assignment, you may use rand, srand, scanf, printf, while, do/while, if, else, else if, break or continue, but not getchar, switch/case, or for. You do not need to keep score, although you may if you wish. I recommend that you use only 4 different images to demonstrate your game in action..

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Current Trends In Database Technology Edbt 2004 Workshops Edbt 2004 Workshops Phd Datax Pim P2panddb And Clustweb Heraklion Crete Greece March 2004 Revised Selected Papers Lncs 3268

Authors: Wolfgang Lindner ,Marco Mesiti ,Can Turker ,Yannis Tzitzikas ,Athena Vakali

2005th Edition

3540233059, 978-3540233053

More Books

Students also viewed these Databases questions

Question

Explain the forces that influence how people handle conflict

Answered: 1 week ago