![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Web Design & Programming Discussion of web design, and server-side & client-side scripting |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: Aug 2007
Posts: 19
OS: xp
|
programing drop dead game
Hi
I am trying to write a code for this game... this if the output that i am trying to make: How many dice would you like to play with (5 - 10)? 5 1 4 4 2 5 2 dice are dead this roll. The score for this roll is 9 1 4 2 1 die is dead this roll. The score for this roll is 5 2 2 2 dice are dead this roll. The score for this roll is 0 but i came with this: How many dice would you like to play with (5 - 10)? 5 1 4 4 2 5 2 dice are dead this roll. The score for this roll is 9 1 4 2 4 6 1 die is dead this roll. The score for this roll is 5 2 2 1 3 3 2 dice are dead this roll. The score for this roll is 0 this is my source: using System; using System.Collections.Generic; using System.Text; namespace DropDead { class DropDead { static void Main(string[] args) { int inputNumber; Console.WriteLine("Welcome to the Scorer for Drop Dead"); Console.WriteLine("How many dice would you like to play with (5 - 10)? "); inputNumber = Convert.ToInt32(Console.ReadLine()); if (inputNumber >= 5 && inputNumber <= 10) { int temp = inputNumber; int[] intArray; intArray = new int[inputNumber]; Random rand = new Random(); int dead_num = 0; int sum = 0; { do { for (int i = 0; i < inputNumber; i++) { int j = rand.Next(1, 7); intArray[i] = j; if (intArray[i] == 2) { dead_num = dead_num + 1; temp = inputNumber - dead_num; } else if (intArray[i] == 5) { dead_num = dead_num + 1; temp = inputNumber - dead_num; } else { sum = sum + intArray[i]; } Console.Write(intArray[i] + " "); } Console.WriteLine(" " + " " + " " + dead_num + " " + "dice are dead this roll." + " " + "The score for this roll is" + " " + sum); } while (temp > 0); } } else { Console.WriteLine("please enter a value between 5 to 10"); } Console.Read(); } } } can anyone help me??? |
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
![]() |
| Thread Tools | |
|
|