Пример #1
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;
            IEEE754_Multiply floating_multiplier = new IEEE754_Multiply();
            float            firstNumber = 0, secondNumber = 0;
            string           first = "", second = "";;

            Console.WriteLine("Множення чисел з плаваючою точкою");
            do
            {
                try
                {
                    Console.Write("Ваше перше число (з плаваючою точкою) (!=0): ");
                    first = Console.ReadLine();
                }
                catch (FormatException exc)
                {
                    Console.WriteLine("Неправильний формат числа: " + exc);
                }
            } while (!float.TryParse(first, out firstNumber) || Int32.Parse(first) == 0);
            do
            {
                try
                {
                    Console.Write("Ваше друге число (з плаваючою точкою) (!=0): ");
                    second = Console.ReadLine();
                }
                catch (FormatException exc)
                {
                    Console.WriteLine("Неправильний формат числа: " + exc);
                }
            } while (!float.TryParse(second, out secondNumber) || Int32.Parse(second) == 0);

            float result = floating_multiplier.FloatingNumbersMultiplication(firstNumber, secondNumber);

            Console.ReadKey();
        }
Пример #2
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;
            IEEE754_Multiply floating_multiplier = new IEEE754_Multiply();
            float            firstNumber = 0, secondNumber = 0;
            string           first = "", second = "";;

            Console.WriteLine("Multiplication of numbers");
            do
            {
                try
                {
                    Console.Write("Enter first value: ");
                    first = Console.ReadLine();
                }
                catch (FormatException exc)
                {
                    Console.WriteLine("Wrong format: " + exc);
                }
            } while (!float.TryParse(first, out firstNumber));
            do
            {
                try
                {
                    Console.Write("Enter second value: ");
                    second = Console.ReadLine();
                }
                catch (FormatException exc)
                {
                    Console.WriteLine("Wrong format: " + exc);
                }
            } while (!float.TryParse(second, out secondNumber));

            float result = floating_multiplier.FloatingNumbersMultiplication(firstNumber, secondNumber);

            Console.ReadKey();
        }