{
class Program
{
static void Main(string[] args)
{
Random randGen = new Random();
int[] diceRolls = new int[11];
for (int i = 1; i <= 7; i++)
{
int diceRoll = randGen.Next(1, 7) + randGen.Next(1, 7);
diceRolls[diceRoll - 2] += 1;
Console.Write(diceRoll + " ");
}
Console.WriteLine();
Console.WriteLine("Here are the totals: ");
for (int i = 2; i <= 12; i++)
{
Console.Write("Dice Roll: {0:}\t Rolled {1:} times", i, diceRolls[i - 2]); Console.WriteLine();
foreach (int j in randomNum)
{
Console.WriteLine("First Number:{0}", j);
{
int result;
Random rnd = new Random();
result = rnd.Next(1, 7);
return result;
}
int dice1;
int dice2;
int result;
Console.WriteLine("This program will ask the user to roll 2 dice after rolling the dice, the program will display the results of each roll. In addition, the sun of the roll should be displayed to the user. After displaying the dice and sum, the program should prompt the user asking if they’d like to roll again");
Console.WriteLine("press any key to continue");
Console.WriteLine("I want to generate the first random dice");
Console.Clear();
dice1 = randNum = new Random();
Console.WriteLine();
Console.WriteLine("--------");
Console.WriteLine("| "(dice1));
Console.WriteLine("| |");
Console.WriteLine("--------");
Console.WriteLine("This program will ask the user to roll 2 dice after rolling the dice, the program will display the results of each roll. In addition, the sun of the roll should be displayed to the user. After displaying the dice and sum, the program should prompt the user asking if they’d like to roll again");
Console.WriteLine("I want to generate the first random dice");
dice2 = randNum = new Random();
Console.WriteLine();
Console.WriteLine("--------");
Console.WriteLine("| "(dice2));
Console.WriteLine("| |");
Console.WriteLine("--------");
result = dice1 + dice2;
Console.WriteLine("The result is {0}.", result);
Console.Read();
}
}
}
}
}
Procom22 0 Newbie Poster
Momerath 1,327 Nearly a Senior Poster Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.