0

I am trying to make a program in which the user is prompted to input a number(max length of 4 digits), and then the program shall produce the number of outcomes of a two dice roll meaning that 1 roll includes two die. The outcomes could be 2-12 and I also have to show how many times the number occurs and the percent the numbers occurs. It should be a bell curve meaning that if a user types 1000 rolls, 7 should have the most out comes and then 6 and 8 and so on. I got part of the program going using my proctors help but the help made me more confused could any body help me?

```
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace DiceRoll_Final
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void rollDice_Click(object sender, EventArgs e)
{
AcceptButton = rollDice;
if (numRolls.Text.Trim() == "")
{
MessageBox.Show("Must enter number of dice rolls");
}
else if (numRolls.Text.Trim() == "0")
{
MessageBox.Show("Must enter a number greatre than 0");
}
int iRolls = int.Parse(numRolls.Text);
// this convert the number of rolls the person wants and assigns it to iRolls
Random randGen = new Random(iRolls);
int iDiceTotal = randGen.Next(1, 6) + randGen.Next(1, 6);
// this will add the two random values to be the equivalent of two dice
int[] numOccurrence = new int[11] {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
// this is an array that has the number of dice there are in
numOccurrence[iDiceTotal]++;
StringBuilder strMsg;
strMsg = new StringBuilder("# of times\n");
for (int i = 2; i <= 12; i++)
{
strMsg.Append(numOccurrence[i].ToString() + "\n");
}
}
}
}
```

*Edited 3 Years Ago by Dani*: Formatting fixed