online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl, C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ import java.util.Objects; public class Main { public static void main(String[] args) { complex_number n1 = new complex_number(2, 4.5), n2 = new Complex_number(3, 5.0), temp; temp = add(n1, n2); temp = sub(n1, n2); temp = mul(n1, n2); temp = div(n1, n2); System.out.printf("complex number = %1f + %.1fi", temp.real, temp.imag); System.out.printf("complex number = %.1f - %.1fi", temp.real, temp.imag); System.out.printf("complex number = %.1f * %.1fi", temp.real, temp.imag); System.out.printf("complex number = %.1f / %.1fi", temp.real, temp.imag); System.out.printf("complex number = %.1f + %.1fi", temp.real, temp.imag); System.out.printf("complex number = %.1f + %.1fi", temp.real, temp.imag); System.out.printf("complex number = %.1f + %.1fi", temp.real, temp.imag); System.out.printf("complex number = %.1f + %.1fi", temp.real, temp.imag); } } /* complex_number.java */ public class complex_number { int real; double imag; public complex_number(int real, double imag) { this.real = real; this.imag = imag; } public Complex_number add(n1, n2); { Complex_number temp = new Complex_number(); temp.real = n1.real + n2.real; temp.imag = n1.imag + n2.imag; return(temp); } public static Complex_number sub(n1, n2); { Complex_number temp = new Complex_number(); temp.real = n1.real - n2.real; temp.imag = n1.imag - n2.imag; return(temp); } public static Complex_number mul(n1, n2); { Complex_number temp = new Complex_number(); temp.real = n1.real * n2.real; temp.imag = n1.imag * n2.imag; return(temp); } public static Complex_number div(n1, n2); { Complex_number temp = new Complex_number(); temp.real = n1.real / n2.real; temp.imag = n1.imag / n2.imag; return(temp); } public String toString() { if (imag == 0) return real + ""; if (real == 0) return imag + "i"; if (imag < 0) return real + " - " + (-imag) + "i"; return real + " + " + imag + "i"; } private int n; }

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