Exemple #1
0
    public static onedimensional operator ++(onedimensional b)
    {
        onedimensional tema = new onedimensional(b.n);

        for (int i = 0; i < tema.n; i++)
        {
            b.b[i] = b.b[i] + 3;
        }
        return(b);
    }
Exemple #2
0
    public static onedimensional operator *(onedimensional op1, int number)
    {
        onedimensional tema = new onedimensional(op1.n);

        for (int i = 0; i < tema.n; i++)
        {
            op1.a[i] = op1.a[i] * number;
        }
        return(op1);
    }
Exemple #3
0
    public static onedimensional operator +(onedimensional op1, onedimensional op2)
    {
        onedimensional tema = new onedimensional(op1.n);

        for (int i = 0; i < tema.n; i++)
        {
            tema.a[i] = op1.a[i] + op2.b[i];
        }
        return(tema);
    }
Exemple #4
0
        private void button3_Click(object sender, EventArgs e)
        {
            textBox1.Clear();

            int size = 0;

            switch (domainUpDown1.SelectedIndex)
            {
            case 0:
                size = 3;
                break;

            case 1:
                size = 4;
                break;

            case 2:
                size = 5;
                break;
            }
            int sizeb = 0;

            switch (numericUpDown3.Value)
            {
            case 0:
                sizeb = 0;
                break;

            case 1:
                sizeb = 1;
                break;

            case 2:
                sizeb = 2;
                break;

            case 3:
                sizeb = 3;
                break;

            case 4:
                sizeb = 4;
                break;
            }
            onedimensional b;

            b = new onedimensional(size);
            b.inpt(2, size, sizeb);
            ++b;
            string s = b.outp(2);

            textBox1.Text = s;
        }
Exemple #5
0
    public static bool operator ==(onedimensional a, onedimensional b)
    {
        onedimensional tema = new onedimensional(b.n);

        for (int i = 0; i < tema.a.Length; i++)
        {
            if (a.a[i] == b.b[i])
            {
                return(false);
            }
        }
        return(true);
    }
Exemple #6
0
        private void button5_Click(object sender, EventArgs e)
        {
            int sizea = 0;
            int sizeb = 0;
            int size  = 0;

            switch (domainUpDown1.SelectedIndex)
            {
            case 0:
                size = 3;
                break;

            case 1:
                size = 4;
                break;

            case 2:
                size = 5;
                break;
            }


            switch (numericUpDown6.Value)
            {
            case 0:
                sizeb = 0;
                break;

            case 1:
                sizeb = 1;
                break;

            case 2:
                sizeb = 2;
                break;

            case 3:
                sizeb = 3;
                break;

            case 4:
                sizeb = 4;
                break;
            }
            switch (numericUpDown7.Value)
            {
            case 2:
                sizea = 2;
                break;

            case 3:
                sizea = 3;
                break;

            case 4:
                sizea = 4;
                break;
            }
            onedimensional a;

            a = new onedimensional(size);
            a.inpt(1, size, sizeb);
            a = a * sizea;
            string s = a.outp(1);

            textBox2.Text = s;
        }
Exemple #7
0
        private void button4_Click(object sender, EventArgs e)
        {
            int sizea = 0;
            int sizeb = 0;
            int size  = 0;

            switch (domainUpDown1.SelectedIndex)
            {
            case 0:
                size = 3;
                break;

            case 1:
                size = 4;
                break;

            case 2:
                size = 5;
                break;
            }

            switch (numericUpDown4.Value)
            {
            case 0:
                sizea = 0;
                break;

            case 1:
                sizea = 1;
                break;

            case 2:
                sizea = 2;
                break;

            case 3:
                sizea = 3;
                break;

            case 4:
                sizea = 4;
                break;
            }
            switch (numericUpDown5.Value)
            {
            case 0:
                sizeb = 0;
                break;

            case 1:
                sizeb = 1;
                break;

            case 2:
                sizeb = 2;
                break;

            case 3:
                sizeb = 3;
                break;

            case 4:
                sizeb = 4;
                break;
            }
            onedimensional a, b;

            a = new onedimensional(size);
            b = new onedimensional(size);
            a.inpt(1, size, sizea);
            b.inpt(2, size, sizeb);

            if (a != b)
            {
                MessageBox.Show("Рядки  не рівні",
                                "Перевірка на рівність");
            }
            else
            {
                MessageBox.Show("Рядки рівні",
                                "Перевірка на рівність");
            }
        }
Exemple #8
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                listBox3.Items.Clear();
                int sizea = 0;
                int sizeb = 0;
                int size  = 0;
                switch (domainUpDown1.SelectedIndex)
                {
                case 0:
                    size = 3;
                    break;

                case 1:
                    size = 4;
                    break;

                case 2:
                    size = 5;
                    break;
                }

                switch (numericUpDown1.Value)
                {
                case 0:
                    sizea = 0;
                    break;

                case 1:
                    sizea = 1;
                    break;

                case 2:
                    sizea = 2;
                    break;

                case 3:
                    sizea = 3;
                    break;

                case 4:
                    sizea = 4;
                    break;
                }
                switch (numericUpDown2.Value)
                {
                case 0:
                    sizeb = 0;
                    break;

                case 1:
                    sizeb = 1;
                    break;

                case 2:
                    sizeb = 2;
                    break;

                case 3:
                    sizeb = 3;
                    break;

                case 4:
                    sizeb = 4;
                    break;
                }



                onedimensional a1, a2, a3;
                a1 = new onedimensional(size);
                a1.inpt(1, size, sizea);
                a2 = new onedimensional(size);
                a2.inpt(2, size, sizeb);
                a3 = new onedimensional(size);
                a3 = a1 + a2;
                string s = a3.outp(1);
                listBox3.Items.Add(s);
            }
            catch
            {
            }
        }