示例#1
0
 //fraction+int
 public static Fraction operator +(Fraction f1, int f2)
 {
     int a = 0, b = 0;
     a = (f2 * f1.Denom) + f1.Numer;
     b = f1.Denom;
     Fraction f = new Fraction(a, b);
     f = f.Pudsad(f);
     return f;
 }
示例#2
0
 //-
 public static Fraction operator -(Fraction f1, Fraction f2)
 {
     int a = 0, b = 0;
     a = (f1.Numer * f2.Denom) - (f2.Numer * f1.Denom);
     b = f1.Denom * f2.Denom;
     Fraction f = new Fraction(a, b);
     f = f.Pudsad(f);
     return f;
 }
示例#3
0
 //++
 public static Fraction operator ++(Fraction f)
 {
     int a = 0, b = 0;
     a = (f.Denom * 1) + f.Numer;
     b = f.Denom;
     Fraction c = new Fraction(a, b);
     c = c.Pudsad(c);
     return c;
 }
示例#4
0
 //int-Fraction
 public static Fraction operator -(int f1,Fraction f2)
 {
     int a = 0, b = 0;
     a = (f1 * f2.Denom) - f2.Numer;
     b = f2.Denom;
     Fraction f = new Fraction(a, b);
     f = f.Pudsad(f);
     return f;
 }