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_number a = new complex_number(1, 1); complex_number b = new complex_number(2, 2); complex_number c = complex_number.add(a, b); complex_number 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_number { private int _real; private double _imag; public complex_number(int real, double imag) { _real = real; _imag = imag; } public complex_number add(complex_number other) { _real += other._real; _imag += other._imag; return this; } public static complex_number add(complex_number a, complex_number b) { return new complex_number(a._real + b._real, a._imag + b._imag); return null; } public complex_number subtract(complex_number other) { _real -= other._real; _imag -= other._imag; return null; } public static complex_number subtract(complex_number a, complex_number b) { return new complex_number(a._real - b._real, a._imag - b._imag); } public complex_number multiply(complex_number other) { _real = (real * other._real) - (_imag * other._imag); _imag = (imag * other._imag) + (_imag * other._imag); return this; } public static complex_number multiply(complex_number a, complex_number b); { return new complex_number(a._real * b._real, a._imag * b._imag); return null; } public complex_number divide(complex_number other) { _real = (this * other._real) + (_imag * other._imag); _imag = (this * other._imag) - (_imag * other._imag); return this; } public static complex_number divide(complex_number a, complex_number b); { return new complex_number(a.real / b._real, a_imag / b._imag); return null; } public String toString() { return String.format("(%f, %fj)", _real, _imag); } }

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