This is a discussion on dice program..... within the Shell Programming forums, part of the Operating Systems category; having difficulty with this please help with code if anyone can. ____________________________________ Write a script that plays a ‘double or ...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
dice program.....
having difficulty with this
please help with code if anyone can. ____________________________________ Write a script that plays a ‘double or nothing’ game. The rules are: a bet is laid and the dice is rolled. If it’s an even number you win double the bet. If it's odd you lose the lot. The program should allow the user to play as many times as they like. Make sure you keep the user informed all the time as to how much they are winning/losing. The dice roll can be done using the following code: Declare an integer variable called dice. typeset –i dice and in the code: ((dice=RANDOM%6+1)) This assigns to dice a random number value between 1 and 6 inclusive. |