1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
public class Complex {
public Complex (int re,int im) {
this.re=re;
this.im=im;
}
private Complex "+" (Complex C1, Complex C2) {
return new Complex(C1.re + C2.re , C1.im + C2.im);
}
private Complex "*" ( int i , Complex C1) {
return new Complex(C1.re * i , C1.im * i);
}
private Complex "--" (Complex C1) {
return new Complex(C1.re --, C1.im -- );
}
public static main () {
int coef=4;
Complex Z1, Z2, Z3;
Z1 = new Complex(3, 5);
Z2 = new Complex(6, 2);
Z3=Z1-- + (coef *Z2);
}
private int re;
private int im;
} |
Partager