Exemplo n.º 1
0
        public static complexclass operator+(complexclass w, complexclass q)
        {
            int          lcm = w.m * q.m / gcd(w.m, q.m);
            int          f   = lcm / w.m * w.n + lcm / q.m * q.n;
            complexclass t   = new complexclass(f, lcm);

            return(t);
        }
Exemplo n.º 2
0
        static void F2(complexclass result)
        {
            XmlSerializer tr = new XmlSerializer(typeof(complexclass));
            FileStream    fs = new FileStream("ser.xml", FileMode.OpenOrCreate, FileAccess.ReadWrite);

            tr.Serialize(fs, result);
            fs.Close();
        }
Exemplo n.º 3
0
        static void F(complexclass result)
        {
            BinaryFormatter tr = new BinaryFormatter();
            FileStream      fs = new FileStream("data.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite);

            tr.Serialize(fs, result);
            fs.Close();
        }
Exemplo n.º 4
0
        static void F3()
        {
            XmlSerializer tr     = new XmlSerializer(typeof(complexclass));
            FileStream    fs     = new FileStream("ser.xml", FileMode.OpenOrCreate, FileAccess.ReadWrite);
            complexclass  result = tr.Deserialize(fs) as complexclass;

            fs.Close();
            Console.WriteLine("deserialized element 2 is : " + result);
        }
Exemplo n.º 5
0
        static void F1()
        {
            BinaryFormatter tr     = new BinaryFormatter();
            FileStream      fs     = new FileStream("data.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite);
            complexclass    result = tr.Deserialize(fs) as complexclass;

            fs.Close();

            Console.WriteLine("deserialized elemen 1 is : " + result);
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            string       a      = Console.ReadLine();
            string       b      = Console.ReadLine();
            int          n      = int.Parse(a.Split('/')[0]);
            int          n_     = int.Parse(a.Split('/')[1]);
            int          m      = int.Parse(b.Split('/')[0]);
            int          m_     = int.Parse(b.Split('/')[1]);
            complexclass y      = new complexclass(n, n_);
            complexclass u      = new complexclass(m, m_);
            complexclass result = y + u;

            Console.WriteLine(result);
            Console.ReadKey();
            F(result);
            F1();
            F2(result);
            F3();
            Console.ReadKey();
        }