public string ToBinary()
        {
            var octaToDecimal = ToDecimal();
            var convert       = new DecimalForm(octaToDecimal);

            return(convert.ToBinary());
        }
        public string ToHex()
        {
            var binaryToDecimal = ToDecimal();
            var convert         = new DecimalForm(binaryToDecimal);

            return(convert.ToHex());
        }
Exemple #3
0
        static void Main(string[] args)
        {
            DecimalForm newDec    = new DecimalForm("8271");
            BinaryForm  newBinary = new BinaryForm("10101010");
            OctalForm   newOcta   = new OctalForm("0123");
            string      ans;
            bool        flag = true;

            while (flag)
            {
                Console.Write("Please enter a number in any base: ");
                ans = Console.ReadLine();
                Show(ans);
                do
                {
                    Console.Write("Do you want to continue(y/n): ");
                    ans = Console.ReadLine();
                } while (ans != "y" && ans != "n");

                if (askUserForContinue(ans))
                {
                    Console.Clear();
                    continue;
                }
                else
                {
                    flag = false;
                }
            }
            Console.WriteLine((int)'A');
        }
        public string ToDecimal()
        {
            var convert = new DecimalForm();

            return(convert.AnySystemToDecimal(this.hexa, 16));
        }
        public string ToDecimal()
        {
            var convert = new DecimalForm();

            return(convert.AnySystemToDecimal(this.binary, 2));
        }