Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Complex {
- public double re,im;
- Complex(double re, double im) {
- this.re = re;
- this.im = im;
- }
- Complex somma(Complex a, Complex b) {
- return new Complex(a.re + b.re, a.im + b.im);
- }
- Complex prodotto(Complex a, Complex b) {
- return new Complex(a.re * b.re - a.im * b.im, (a.re * b.im + a.im * b.re));
- }
- double abs() {
- return re*re + im*im;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement