Ejemplo n.º 1
0
        public static Ulamek operator +(Ulamek u1, Ulamek u2)
        {
            Ulamek wynik = new Ulamek(u1.Licznik * u2.Mianownik + u2.Licznik * u1.Mianownik, u1.Mianownik * u2.Mianownik);

            wynik.Uprosc();
            return(wynik);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            // equals vs ==
            // EqualsVsComparison();

            // abstract class and method
            // AbstractTrain();

            // are you a man or a woman?
            // GuessYourSex.AreYouAManOrAWoman2();

            // message dialog box
            // Console.WriteLine("Hello world!");
            // MessageBox.Show("No siema siema");

            // get system info
            // SystemInfoMyClass.PrintAllInfo();


            // DniTygodnia day = DniTygodnia.poniedzialek;
            // Console.WriteLine("Poniedzialek to pierwszy dzień tygodnia? : " + ((int)day == 2));

            //string s = "napis";
            //ModifyString(ref s);
            // string s2;
            // ModifyString2(out s2);
            // Console.WriteLine(s);

            // DelegateTest delegateTest = new DelegateTest();
            // delegateTest.MainDelegate();

            //List<int> l = new List<int>(new[] { 1, 2, 3, 4, 5 });
            //List<int> l = new List<int> { 1, 2, 3, 4, 5 };

            //string napis = "";
            //foreach (var e in l) napis += (e.ToString() + " ");
            //Console.WriteLine("przed: " + napis);
            //for(int i=0; i<l.Count(); i++)
            //{
            //    l.RemoveAt(i);
            //}
            //napis = "";
            //foreach (var e in l) napis += (e.ToString() + " ");
            //Console.WriteLine("po: " + napis);

            Ulamek u1 = new Ulamek(1, 2);

            Console.WriteLine(u1.ToString());
            u1 += new Ulamek(6, 4);
            Console.WriteLine(u1.ToString());

            Console.ReadKey();
        }