Beispiel #1
0
        private void uxFindPrimes_Click(object sender, EventArgs e)
        {
            int bound = 0;

            try
            {
                bound = Convert.ToInt32(uxNumberBound.Text);
            } catch (FormatException)
            {
                MessageBox.Show("Invalid bound");
                return;
            }
            SieveList list = new SieveList();

            list.BuildList(bound);
            list.FindPrimes();
            StringBuilder s = new StringBuilder();

            foreach (int i in list)
            {
                s.Append(i);
                s.Append(' ');
            }
            uxPrimes.Text = s.ToString();
        }
 private void uxFindPrimes_Click(object sender, EventArgs e)
 {
     _list = new SieveList(Convert.ToInt32(uxUpperBound.Text));
     _list.FindPrimes();
     foreach (int val in _list)
     {
         uxPrimes.Text += val + " ";
     }
 }
        private void uxFindPrimeButton_Click(object sender, EventArgs e)
        {
            uxOutput.Text = "";
            int       bound = Convert.ToInt32(uxInput.Text);
            SieveList list  = new SieveList();

            list.BuildList(bound);
            list.FindPrimes();
            foreach (int num in list)
            {
                uxOutput.Text += num + " ";
            }
        }