예제 #1
0
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        /// <param name="args">The arguments.</param>
        public static void Main(string[] args)
        {
            char condition;

            do
            {
                Console.WriteLine("Press 1 for  : Replace the string");
                Console.WriteLine("Press 2 for  : Probability Percentage for flip coin");
                Console.WriteLine("Press 3 for  : Identify leap year or not");
                Console.WriteLine("Press 4 for  : Print Power Of two");
                Console.WriteLine("Press 5 for  : To print harmonic series");
                Console.WriteLine("Press 6 for  : To print Prime Factors");
                Console.WriteLine("Press 7 for  : Gambler Play");
                Console.WriteLine("Press 8 for  : Distinct Coupons");
                Console.WriteLine("Press 9 for  : Two Dimentional Array");
                Console.WriteLine("Press 10 for : Print Triplet sums to zero");
                Console.WriteLine("Press 11 for : Print Euclidean Distance of point(x,y) from origin (0,0)");
                Console.WriteLine("Press 12 for : Print roots of quadratic equation");
                Console.WriteLine("Press 13 for : Calculate the Wind Chill ");
                Console.WriteLine("Press 14 for : Calulate Elapsed Time ");
                Console.WriteLine("Press 15 for : Play Tic-Tac-Toe Game");
                int ch = Convert.ToInt32(Console.ReadLine());
                switch (ch)
                {
                case 1:
                    ReplaceString rs = new ReplaceString();
                    rs.ReplaceString1();
                    break;

                case 2:
                    FlipCoin fp = new FlipCoin();

                    fp.FlipCoin1();
                    break;

                case 3:
                    Leapyear1 lp = new Leapyear1();
                    lp.CalcLeapYear();
                    break;

                case 4:
                    PowerOfTwo p = new PowerOfTwo();
                    p.Input();
                    break;

                case 5:
                    HarmonicSeries hs = new HarmonicSeries();
                    hs.Harmonic();
                    break;

                case 6:
                    PrimeFactor pf = new PrimeFactor();
                    pf.Factor();
                    break;

                case 7:
                    Gambler g = new Gambler();
                    g.GamblerPlay();
                    break;

                case 8:
                    Coupon c = new Coupon();
                    c.DistinctCoupon();
                    break;

                case 9:
                    TwoDArray td = new TwoDArray();
                    td.TwoDArrays();
                    break;

                case 10:
                    Triplet t = new Triplet();
                    t.Tripletsumzero();
                    break;

                case 11:
                    Distance d = new Distance();
                    d.EuclideanDistance();
                    break;

                case 12:
                    Quadratic q = new Quadratic();
                    q.RootsOfQuadraticEquation();
                    break;

                case 13:
                    WindChill wc = new WindChill();
                    wc.CalculateWindChill();
                    break;

                case 14:
                    StopWatch sw = new StopWatch();
                    sw.CalculateElapsedTime();
                    break;

                case 15:
                    TicTacToeTest tp = new TicTacToeTest();
                    tp.PlayTicTacToeTest();
                    break;

                default:
                    Console.WriteLine("no not in range");
                    break;
                }

                Console.WriteLine("enter Y to continue and enter N to exit");
                condition = Convert.ToChar(Console.ReadLine());
            }while (condition == 'y');
        }
예제 #2
0
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        /// <param name="args">The arguments.</param>
        public static void Main(string[] args)
        {
            Console.WriteLine("Enter Your Choice");
            int n = int.Parse(Console.ReadLine());
            switch (n)
            {
                case 0:
                    string str = "ABC";
                    int n1 = str.Length;
                    Practice.permute(str, 0, n1 - 1);
                    Console.ReadKey();
                    break;

                case 1:
                   Distance d = new Distance();
                   Distance.calculateDistance();
                    break;
                case 2:
                    ReplaceString r = new ReplaceString();
                    r.replaceString();
                    break;
                case 3:
                    FlipCoin f = new FlipCoin();
                    f.calculateFlipCoin();
                    break;
                case 4:
                    LeapYear l = new LeapYear();
                    l.leafYear();
                    break;
                case 5:
                    PowerOf2 p = new PowerOf2();
                    p.powerOf2();
                    break;
                case 6:
                    Harmonic h = new Harmonic();
                    h.harmonic();
                    break;
                case 7:
                    PrimeFactor.calculatePrimeFactor();
                    break;
                case 8:
                    Gambler.gambler();
                    break;
                case 9:
                    // int min = 1;
                    Console.WriteLine("Enter The Number");
                    int number = int.Parse(Console.ReadLine());
                    int a = DistinctCoupon.collect(number);
                    Console.WriteLine(a);
                    Console.ReadKey();
                    break;
                case 10:
                    Array2D.calculat2Darray();
                    break;
                case 11:
                    Triplets.calculateTriple();
                    break;
                case 12:
                    StopWatch s = new StopWatch();
                    s.stopWatch();
                    break;
                case 13:
                    Quadratic.quadraticEquations();
                    break;
                case 14:
                    WindChill.calculateWindTemp();
                    break;
                case 15:
                    Console.WriteLine("Enter The String");
                    string name = Console.ReadLine();

                    string permute = (string)Permutation.permute(name, 0, name.Length - 1);
                    Console.WriteLine(permute);
                    Console.Read();
                    break;

                default:
                    Console.WriteLine();
                    break;
          }
    }