Пример #1
0
        public static void Main()
        {
            Cal c = new Cal();

            c.exercise(10);
            Console.ReadKey();
        }
Пример #2
0
        public static void MenyChoice(Cal cal)
        {
            var userInput = Console.ReadLine();

            switch (userInput)
            {
            case "1":
                Console.WriteLine("Enter two numbers to add!");
                cal.SetFirstAndSecond(double.Parse(Console.ReadLine()), double.Parse(Console.ReadLine()));
                Console.WriteLine("The sum is: " + cal.SumNumbers());
                WriteMenu();
                break;

            case "2":
                Console.WriteLine("Enter two numbers to multiply!");
                cal.SetFirstAndSecond(double.Parse(Console.ReadLine()), double.Parse(Console.ReadLine()));
                Console.WriteLine("The product of the numbers is: " + cal.MultipleNumbers());
                WriteMenu();
                break;

            case "3":
                Console.WriteLine("Enter two numbers!");
                cal.SetFirstAndSecond(double.Parse(Console.ReadLine()), double.Parse(Console.ReadLine()));
                Console.WriteLine("Sum in between is: " + cal.SumInBetween());
                WriteMenu();
                break;

            case "4":
                Console.WriteLine("Enter a number to save to memory!");
                cal.NumberInMemory = double.Parse(Console.ReadLine());
                Console.WriteLine("Number added to memory!");
                WriteMenu();
                break;

            case "5":
                cal = new Cal();
                Console.WriteLine("Memory cleared!");
                WriteMenu();
                break;

            case "6":
                Console.WriteLine("Number in memory is: " + cal.NumberInMemory);
                WriteMenu();
                break;

            case "7":
                System.Environment.Exit(1);
                break;

            default:

                break;
            }
        }
Пример #3
0
        public static void Main(string[] args)
        {
            Cal cal = new Cal();

            Console.WriteLine(cal);

            WriteMenu();
            while (true)
            {
                MenyChoice(cal);
            }
        }
Пример #4
0
        static void Main(string[] args)
        {
            Cal    MyCal = new Cal();
            float  Num1, Num2, Result = 0;
            string Sel;


            while (true)
            {
                Console.WriteLine("두 수의 사칙연산 프로그램");
                Console.Write("첫번째 수 : ");
                Num1 = float.Parse(Console.ReadLine());
                Console.Write("두번째 수 : ");
                Num2 = float.Parse(Console.ReadLine());

                Console.Write("연산기호를 선택하세요. (+,-,*,/) : ");
                Sel = Console.ReadLine();

                if (Sel == "+")
                {
                    Result = MyCal.Plus(Num1, Num2);
                    Console.WriteLine("연산결과 : {0}", Result);
                }

                else if (Sel == "-")
                {
                    Result = MyCal.Minus(Num1, Num2);
                    Console.WriteLine("연산결과 : {0}", Result);
                }

                else if (Sel == "*")
                {
                    Result = MyCal.Mul(Num1, Num2);
                    Console.WriteLine("연산결과 : {0}", Result);
                }

                else if (Sel == "/")
                {
                    Result = MyCal.Div(Num1, Num2);
                    Console.WriteLine("연산결과 : {0}", Result);
                }
                else
                {
                    Console.WriteLine("연산기호를 잘못 입력했습니다.");
                }

                if (Sel == "END")
                {
                    break;
                }
            }
        }
Пример #5
0
        static void Main(string[] args)
        {
            Cal c  = new Cal();
            Cal c1 = new Cal(10, 20);
            Cal c2 = new Cal(20, 10);
            Cal c3 = new Cal(10, 20);
            Cal c4 = new Cal(20, 10);

            Console.WriteLine("Addition of two numbers :" + c1.add());
            Console.WriteLine("Subtraction of two numbers:" + c2.sub());
            Console.WriteLine("multiplication of two numbers:" + c3.mul());
            Console.WriteLine("division of two numbers:" + c4.div());
            Console.ReadKey();
        }
Пример #6
0
        private void ComputeButton_Click(object sender, EventArgs e)
        {
            if (txtInput.Length > 0)
            {
                this.Analyse(txtInput);
            }

            // create the text for output in ShowBox
            this.txtOutput = "";
            foreach (Compute Cal in this.Calculs)
            {
                this.txtOutput += Cal.ToString();
            }

            // write text in ShowBox
            ShowBox.Text = this.txtOutput;
        }
Пример #7
0
 private void Login_Click(object sender, EventArgs e)
 {
     if (username_text.Text == "Jyothi" || username_text.Text == "jyothi" && password_text.Text == "2016cse220")
     {
         MessageBox.Show("Login successful");
         username_text.Clear();
         password_text.Clear();
         Cal obj = new Cal();
         obj.Show();
     }
     else if (username_text.Text == "" && password_text.Text == "")
     {
         MessageBox.Show("Please enter the fields");
     }
     else
     {
         MessageBox.Show("Please enter the correct detials");
         username_text.Clear();
         password_text.Clear();
     }
 }
Пример #8
0
        public Calculator()
        {
            var enCal = new Cal();

            Console.WriteLine(enCal);
        }