-
rolling of two dice
write a program that simulates the rolling of two dice. the program should use rand to run the first die and sjould use rand again to roll the second die. the sum of two values should then be calculated. your programe should roll the dice 36000 times. use a single subscripted array to tally the number of times each possible sum appears. print the results in a tabular format. also determine if the totals are reasonable.
-
Hint: rand()%6 +1 is a value from 1..6, assuming you have 6-sided dice, which it does not say (common dice: 4,6,8,10,12,20,30,100). The results won't always be what you expect because most c++ compilers have crappy rand functions and using % on it makes it worse.
Code it up and ask again when you have made an attempt at it.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks