View difference between Paste ID: qMm1gbQP and 1zGwf0J9
SHOW: | | - or go back to the newest paste.
1
using System;
2
using System.Collections.Generic;
3
using System.ComponentModel;
4
using System.Data;
5
using System.Drawing;
6
using System.Linq;
7
using System.Text;
8
using System.Windows.Forms;
9
10
namespace WindowsFormsApplication1
11
{
12
    public partial class Form7 : Form
13
    {
14
        public Form7()
15
        {
16
            InitializeComponent();
17
        }
18
19
        private void button1_Click(object sender, EventArgs e)
20
        {
21
            //Объявление массивов и переменных для выполнения задания;
22-
            Random rnd = new Random(10);
22+
            Random rnd = new Random();
23
            int[] arr = new int[10];
24
            label1.Text = String.Empty;
25-
            int x;
25+
26
            for (int i = 0; i < 10; i++)
27
            {
28
                arr[i] = rnd.Next(10, 50);
29
                for (int j = 0; j < 10; j++)
30-
                x = rnd.Next(10,50);
30+
31-
                if (arr[i]==x)
31+
                    do
32
                    {
33-
                    x = rnd.Next(10,50);
33+
                        if (arr[i] == arr[j])
34-
                    i = 0;
34+
                        {
35
                            arr[i] = rnd.Next(10, 50);
36-
                //Вывод массива на форму;
36+
                            j = 0;
37
                        }
38
                        else j--;
39
                    } while (j < 10);
40
41
                }
42
                    
43
                
44
45-
    }
45+
                    //Вывод массива на форму;
46
                label1.Text += Convert.ToString(arr[i]) + ",";
47
               }
48
            }
49
50
                
51
            
52
53
                
54
55
            }
56
        }