Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

need help with DiceRoll simulation?

simulation

  • Please log in to reply
No replies to this topic

#1 maximus123

maximus123

    CC Newcomer

  • Just Joined
  • PipPip
  • 13 posts

Posted 26 October 2010 - 05:34 PM

hi I'm having problem with calling GetDice1 and GetDice2 to work in my main method so if anyone can help me out..reply now !

here are my program:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RollDiceApp
{
    class Program
    {
        static void Main(string[] args)
        {
            int numRolls, dice1, dice2, GetInput, die;
            int[] DiceRoll;
            int numCount;
            double D;
            DiceRoll = GetDice1(out die);
            

            string inValue;
            //string D;

            Console.WriteLine(" This program will ask the user to roll 2 dice");
            Console.WriteLine("\n The progrm will ask save the value for each dice in a seperate array");
            Console.WriteLine("\n Between each role, the program should prompt the user to roll again");
            Console.WriteLine("\n After rolling the dice, the program will ouput a summary table for the session");
            Console.WriteLine("\n Press any key to continue");
            inValue = Console.ReadLine();
            Console.Clear();
            Console.ReadLine();
        }
        public static void GetDice1(string die, out int D)
        {
            int numRolls;
            int[] DiceRoll;
            



            Random randnum = new Random();
            int[] dice1 = new int[10];
            int[] dice2 = new int[10];
            for (int counter = 0; counter < 11; counter++)
            {

                string inValue;
                char response = 'N';
                //double D;
                Console.WriteLine(" First dice rolled the following ");
                Console.WriteLine("    -------------------------");
                Console.WriteLine("    |                       |");
                Console.WriteLine("    |                       |");
                Console.WriteLine("    |          {0}          |");
                Console.WriteLine("    |                       |");
                Console.WriteLine("    |                       |");
                Console.WriteLine("    -------------------------");
                Console.WriteLine(" would you like to roll again?");
                Console.WriteLine(" Please enter 'y' for yes or any other letter for no:");
                inValue = Console.ReadLine();
                response = Convert.ToChar(inValue);
                while ((response == 'Y') || (response == 'y'))
                    inValue = Console.ReadLine();
                D = Convert.ToInt32(inValue);
                Console.ReadLine();


            }
            
        }


        public static void GetDice2()
        {
            Random randnum = new Random();
            int[] dice1 = new int[10];
            int[] dice2 = new int[10];


            for (int counter = 0; counter < 11; counter++)
            {

                string inValue;
                double D;
                Console.WriteLine(" Second dice rolled the following");
                Console.WriteLine("    -------------------------");
                Console.WriteLine("    |                       |");
                Console.WriteLine("    |                       |");
                Console.WriteLine("    |          {0}          |");
                Console.WriteLine("    |                       |");
                Console.WriteLine("    |                       |");
                Console.WriteLine("    -------------------------");
                inValue = Console.ReadLine();
                D = Convert.ToInt32(inValue);
                Console.ReadLine();

            }
        }
        public static void GetInput()
            {
                int counter = 10;

    }
}}

Edited by dargueta, 26 October 2010 - 07:54 PM.
Added code tags

  • 0





Also tagged with one or more of these keywords: simulation

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download