View difference between Paste ID: BsSb6sBQ and ewRWVmsk
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();
23
            int[] arr = new int[10];
24
            label1.Text = String.Empty;
25
            //Начало цикла заполнения массива;
26
            for (int i = 0; i < 10; i++)
27
            {
28-
                arr[i] = rnd.Next(10, 50);
28+
29
                {
30
                    if (arr[i] == arr[j])
31-
                    do
31+
32
                            arr[i] = rnd.Next(10, 50);
33-
                        if (arr[i] == arr[j])
33+
34
                        }
35
                        else j++;
36
                    if (j == 10 || i==10)
37
                    {
38
                        arr[i] = rnd.Next(10, 50);
39-
                    } while (j < 10);
39+
                    }
40
                }
41
                    
42
                //Вывод массива на форму;
43
                label1.Text += Convert.ToString(arr[i]) + ",";
44
               }
45-
                    //Вывод массива на форму;
45+
46
47
                
48
            
49
50
                
51
52
            }
53
        }