online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
import java.io.*; public class Main { public static void main(String[] args) { Complex a = new Complex(1, 1); Complex b = new Complex(2, 2); Complex c = Complex.add(a, b); Complex d = a.add(b); System.out.println(a); System.out.println(b); System.out.println(c); System.out.println(d); // TODO: Test -, *, / } }
public class Complex { private double _real; private double _imaginary; public Complex(double real, double imaginary) { _real = real; _imaginary = imaginary; } public Complex add(Complex other) { _real += other._real; _imaginary += other._imaginary; return this; } public static Complex add(Complex a, Complex b) { return new Complex(a._real + b._real, a._imaginary + b._imaginary); } public Complex subtract(Complex other) { //_real = ??? //_imaginary = ??? return this; } public static Complex subtract(Complex a, Complex b) { //return new Complex(???, ???); return null; } public Complex multiply(Complex other) { //_real = ??? //_imaginary = ??? return this; } public static Complex multiply(Complex a, Complex b) { //return new Complex(???, ???); return null; } public Complex divide(Complex other) { //_real = ??? //_imaginary = ??? return this; } public static Complex divide(Complex a, Complex b) { //return new Complex(???, ???); return null; } public String toString() { return String.format("(%f, %fj)", _real, _imaginary); } }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue