Skip to content

Instantly share code, notes, and snippets.

@johnhmj
Created January 13, 2010 01:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnhmj/275842 to your computer and use it in GitHub Desktop.
Save johnhmj/275842 to your computer and use it in GitHub Desktop.
import java.io.*;
public class CComplex {
public double real;
public double imaginary;
private PrintStream jout = new PrintStream(System.out);
CComplex()
{
this.real = 0;
this.imaginary = 0;
}
public void Print()
{
this.jout.printf(" %.2f", this.real);
if ( this.imaginary == 0 )
{
return;
}
this.jout.printf(" + %.2f * i", this.imaginary);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment