public static void Main(string[] args) { Bruch b1 = new Bruch (3,8); /* Bruch b2 = new Bruch (3, 0); Bruch b3 = new Bruch (55); Console.Write ("zähler:"); int z = Convert.ToInt32 (Console.ReadLine()); Console.Write ("Nenner:"); int n = Convert.ToInt32 (Console.ReadLine ()); Bruch b4 = new Bruch (z, n); Bruch b5 = new Bruch (); */ b1.add (new Bruch(7,5)); b1.print(); }
//bruch addieren public void add(Bruch b) { zaehler = zaehler * b.nenner + b.zaehler * nenner; nenner = nenner * b.nenner; }
public static Bruch add(Bruch left, Bruch right) { Bruch temp = new Bruch (left); temp.add (right); return temp; }