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); } }
public class complex_number { private double _real; private double _imag; public complex_number(double 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 this; } public static complex_number subtract(complex_number a, complex_number b) { return new complex_number(b._real - a._real, b._imag - a._imag); return null; } public complex_number multiply(complex_number other) { _real = _real * other._real; _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 new complex_number(a._real * b._imag + b._real * a._imag); return null; } public complex_number divide(complex_number other) { _real = _real / other._real; _imag = _imag / other._imag; return this; } public static complex_number divide(complex_number a, complex_number b) { double real, imag, deno; deno = (b._real * b._real + b._imag * b._imag); return new complex_number(a._real * b._real + a._imag * b._imag)/deno; return new complex_number(b._real * a._imag - a._real * b._imag)/deno; 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