Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.Default;
            Console.WriteLine("Enter A number:");
            float multiplicandF = float.Parse(Console.ReadLine());

            Console.WriteLine("Enter B number:");
            float multiplierF = float.Parse(Console.ReadLine());

            Console.WriteLine("Result is: {0}", IEEE.MultiplyIEEE(multiplicandF, multiplierF));
            Console.ReadKey();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            bool exec = true;

            do
            {
                Console.OutputEncoding = Encoding.Default;
                try
                {
                    Console.WriteLine("Entet wishful operation 1- * , 2- / , 3- float , 4-exit");
                    int operation = int.Parse(Console.ReadLine());
                    switch (operation)
                    {
                    case 1:
                        int multiplicand = int.Parse(Console.ReadLine());
                        int multiplier   = int.Parse(Console.ReadLine());
                        Console.WriteLine("Result is: " + Multiplication.ShiftingRight(multiplicand, multiplier));
                        Console.ReadKey();
                        break;

                    case 2:
                        int dividend = int.Parse(Console.ReadLine());
                        int divisor  = int.Parse(Console.ReadLine());
                        Console.WriteLine("Result is:" + Division.ShiftingRight(dividend, divisor));
                        Console.ReadKey();
                        break;

                    case 3:
                        float multiplicandF = float.Parse(Console.ReadLine());
                        float multiplierF   = float.Parse(Console.ReadLine());
                        Console.WriteLine("Result is: {0}", IEEE.MultiplyIEEE(multiplicandF, multiplierF));
                        Console.ReadKey();
                        break;

                    case 4:
                        exec = false;
                        break;

                    default: break;
                    }
                }
                catch (OverflowException)
                {
                    Console.WriteLine("Too big value!!!");
                }
                catch (FormatException)
                {
                    Console.WriteLine("Wrong format!!!");
                }
            }while (exec);
        }