Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dice game

Status
Not open for further replies.

pintto

Programmer
Mar 23, 2001
2
0
0
US
Trying to make a dice game in Qbasic, how do I get it so there can be wages made and so it works
 
It depends on what exactly you want... Your question is very vague and can have a whole slu of answers. But, here's my stab at it.

You need a variable for the total amount won, and a variable for the wager. Roll the dice and if the user won, add the wager*2 to the total won.

Without specifics I can't really give you example code or anything, sorry.

 
Things like that are where the creativity comes in and the programming ends. The programming for that would be very simple. Just using several random numbers for the dice and a couple variables for the wagers and the total ammount of money the player has.
But as for the logic of the program. Try making it where the player just inputs how much money they want to bet on the game. Then the dice are rolled and if the numbers on the dice add up to like 7 or 11 or something like that, the player wins the ammount of money the wagered. Like:
TOTAL% = TOTAL% + WAGER%

And if they lost, just subtract the WAGER%. From there, you can add varaitions to wins/losses, and whatever else you might see fit.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top