예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            int input;

            input = int.Parse(Choice.Text);
            if (input == 1)
            {
                FileStream             f      = new FileStream("DIV.txt", FileMode.Append);
                StreamWriter           sw     = new StreamWriter(f);
                string                 first  = FirstNum.Text;
                string                 second = SecondNum.Text;
                Tuple <string, string> Answer = BigInt.DIV(first, second);
                Result.Text = (Answer.Item1).ToString(); //BigInt.DIV(first, second).ToString();
                sw.WriteLine(Result.Text);
                sw.Close();
                f.Close();
            }
            else if (input == 2)
            {
                FileStream   f      = new FileStream("SUB.txt", FileMode.Append);
                StreamWriter sw     = new StreamWriter(f);
                string       first  = FirstNum.Text;
                string       second = SecondNum.Text;
                Result.Text = BigInt.SUB(first, second).ToString();
                sw.WriteLine(Result.Text);
                sw.Close();
                f.Close();
            }
            else if (input == 3)
            {
                FileStream   f      = new FileStream("MUL.txt", FileMode.Append);
                StreamWriter sw     = new StreamWriter(f);
                string       first  = FirstNum.Text;
                string       second = SecondNum.Text;
                Result.Text = BigInt.MUL(first, second).ToString();
                sw.WriteLine(Result.Text);
                sw.Close();
                f.Close();
            }
            else if (input == 4)
            {
                string first  = FirstNum.Text;
                string second = SecondNum.Text;
                string third  = ThirdNum.Text;
                Result.Text = BigInt.ModOfPower(first, second, third).ToString();
            }
            else
            {
                MessageBox.Show("Invalid Choice");
            }
            Choice.Clear();
            FirstNum.Clear();
            SecondNum.Clear();
        }
예제 #2
0
파일: Form1.cs 프로젝트: zyadantar30/RSA
        private void button1_Click(object sender, EventArgs e)
        {
            int input;

            input = int.Parse(Choice.Text);
            if (input == 1)
            {
                FileStream   f      = new FileStream("ADD.txt", FileMode.Append);
                StreamWriter sw     = new StreamWriter(f);
                string       first  = FirstNum.Text;
                string       second = SecondNum.Text;
                Result.Text = BigInt.Add(first, second).ToString();
                sw.WriteLine(Result.Text);
                sw.Close();
                f.Close();
            }
            else if (input == 2)
            {
                FileStream   f      = new FileStream("SUB.txt", FileMode.Append);
                StreamWriter sw     = new StreamWriter(f);
                string       first  = FirstNum.Text;
                string       second = SecondNum.Text;
                Result.Text = BigInt.SUB(first, second).ToString();
                sw.WriteLine(Result.Text);
                sw.Close();
                f.Close();
            }
            else if (input == 3)
            {
                FileStream   f      = new FileStream("MUL.txt", FileMode.Append);
                StreamWriter sw     = new StreamWriter(f);
                string       first  = FirstNum.Text;
                string       second = SecondNum.Text;
                Result.Text = BigInt.MUL(first, second).ToString();
                sw.WriteLine(Result.Text);
                sw.Close();
                f.Close();
            }
            else
            {
                MessageBox.Show("Invalid Choice");
            }
            Choice.Clear();
            FirstNum.Clear();
            SecondNum.Clear();
        }