954,525 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

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.

riverrock
Newbie Poster
1 post since Feb 2006
Reputation Points: 10
Solved Threads: 0
 

Sorry.

We don't do your homework for you here on this forum. Please post some code, and we'll help troubleshoot it. We will not write your code for you.

alc6379
Cookie... That's it
Team Colleague
2,820 posts since Dec 2003
Reputation Points: 186
Solved Threads: 147
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You