Beispiel #1
0
        static void Main(string[] args)
        {
            Int16 Main_Menu_position = 1;
            calculator My_Calculator = new calculator();
            Factorial My_Factorial_Calc = new Factorial();
            Random My_Random_Number = new Random();
            Guess_of_Number Guess_of_Number = new Guess_of_Number();
            string String_number_for_factorial = "";
            string A_String = "";
            string B_String = "";
            Console.WriteLine("Please select type of:");
            Console.WriteLine("1. Puzzle \"The farmer, wolf, goat and cabbage\""); // RV: Don't see the implementation of this part
            Console.WriteLine("2. Simple calculator");
            Console.WriteLine("3. The factorial of the number");
            Console.WriteLine("4. Guess the number");
            Console.Write("Write menu NUMBER and thn press enter:");

            Main_Menu_position = Int16.Parse(Console.ReadLine());

            switch (Main_Menu_position)
            {
                case 2:
                    Console.Clear();
                    Console.WriteLine("Simple calculator");
                    Console.WriteLine("Please select operation type");
                    Console.WriteLine("1. Multiplication  A*B");
                    Console.WriteLine("2. Divide          A/B");
                    Console.WriteLine("3. Addition        A+B");
                    Console.WriteLine("4. Substuction     A-B");
                    Console.WriteLine("5. Substuction     A^B");
                    Console.Write("Write menu NUMBER and thn press enter:");
                    My_Calculator.Operation_Type = Int16.Parse(Console.ReadLine());
                    Console.Write("Pleas set the A:");
                    A_String = Console.ReadLine();
                    Console.Write("Pleas set the B:");
                    B_String = Console.ReadLine();
                    Console.WriteLine("");
                    Console.WriteLine(My_Calculator.Calc_Data(A_String, B_String));
                    break;
                case 3:
                    Console.Clear();
                    Console.WriteLine("Fatorial calculation");
                    Console.Write("Write menu NUMBER and thn press enter:");
                    String_number_for_factorial = Console.ReadLine();
                    Console.WriteLine(My_Factorial_Calc.Factorial_Calc(String_number_for_factorial));
                    break;
                case 4:
                    Console.Clear();
                    Console.WriteLine("Guess the number, between 1 and 100");
                    Guess_of_Number.Guess_of_number(My_Random_Number.Next(1, 100));
                    break;
            }

            Console.ReadLine();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            calculator c = new calculator();
            var        s = c.sum(4, 5);

            Console.WriteLine("sum is:" + s);