The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
A program to trace execution of another program jiten_hegde High Level Programming 3 08-19-2008 02:26 AM
How to write to stdin of another program (program A -> [stdin]program B) vvaidyan UNIX for Dummies Questions & Answers 3 08-02-2008 02:21 PM
How to write to stdin of another program (program A -> [stdin]program B) vvaidyan High Level Programming 1 04-30-2008 10:44 AM
executing a program within a program Gekko High Level Programming 4 06-27-2002 12:36 PM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 02-21-2006
Registered User
 

Join Date: Feb 2006
Posts: 1
a 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.
Forum Sponsor
  #2  
Old 02-21-2006
Ygor's Avatar
Moderator
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,249
Thread closed due to violation of the "No Homework" rule.
Google The UNIX and Linux Forums
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 03:46 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0