lundi 10 avril 2017

C# counting repeating numbers

I need a way to find and count the repeating numbers of this RNG.

So when I press the button like 500 times it need to count the times the same number apeared any ideas ? (Build in Visial Studio 2017 C#)

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Alpha_rng
{
public partial class RNG : Form
{
    private int number;
    public RNG()
    {
        InitializeComponent();
    }

    public int tal { get; private set; }

    private void button1_Click(object sender, EventArgs e)
    {
        Random slumpGenerator = new Random(); 
        int tal;
        tal = slumpGenerator.Next(0, 1000);
        textBox1.Text = tal.ToString();
        if (tal <=  10)
            MessageBox.Show ("Nat 5");
        if (tal >= 11 && tal <= 100) 
            MessageBox.Show("Nat 4");
        else 
            MessageBox.Show("Nat 3");
    }
  }
}




Aucun commentaire:

Enregistrer un commentaire