Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            int i1 = 11, i2 = 21;

            float f1 = 3.14f, f2 = 6.14f;

            char c1 = 'a', c2 = 'b';

            double d1 = 8.0, d2 = 9.0;

            Marvellous mobj = new Marvellous();

            Console.WriteLine("Before Swap Integers:{0} & {1}", i1, i2);
            mobj.Swap(ref i1, ref i2);
            Console.WriteLine("After Swap Integers:{0} & {1}", i1, i2);
            Console.WriteLine();

            Console.WriteLine("Before Swap Floats:{0} & {1}", f1, f2);
            mobj.Swap(ref f1, ref f2);
            Console.WriteLine("After Swap Floats:{0} & {1}", f1, f2);
            Console.WriteLine();

            Console.WriteLine("Before Swap Characters:{0} & {1}", c1, c2);
            mobj.Swap(ref c1, ref c2);
            Console.WriteLine("After Swap Characters:{0} & {1}", c1, c2);
            Console.WriteLine();

            Console.WriteLine("Before Swap Doubles:{0} & {1}", d1, d2);
            mobj.Swap(ref d1, ref d2);
            Console.WriteLine("After Swap Doubles:{0} & {1}", d1, d2);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Marvellous mobj = new Marvellous();

            mobj.fun();

            mobj.gun();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Marvellous mobj = new Marvellous();

            Thread t1 = new Thread(new ThreadStart(mobj.fun));

            t1.Name = "Thread Marvellous..";

            t1.Start();

            t1.Join();

            Console.WriteLine("Main Thread is running..");
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Enter Number:");
            int value = Convert.ToInt16(Console.ReadLine());

            Marvellous mobj = new Marvellous(value);

            Thread t1 = new Thread(new ThreadStart(mobj.ChkPrime));

            Thread t2 = new Thread(new ThreadStart(mobj.ChkPerfect));

            t1.Start();

            t2.Start();
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            Console.WriteLine("Enter Starting Range:");
            int value1 = Convert.ToInt16(Console.ReadLine());

            Console.WriteLine("Enter Ending Range:");
            int value2 = Convert.ToInt16(Console.ReadLine());

            Marvellous mobj = new Marvellous();

            Thread t1 = new Thread(() => mobj.DisplayRange(value1, value2));

            // Thread t2 = new Thread(new ThreadStart(mobj.DisplayRange(value1,value2)));

            t1.Start();
        }