online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
// Prototipo de clases para MiApp. import java.util.Scanner; class MiApp{ private static IO io = null; private static DB db = null; public static void main(String[] args){ Scanner sc = new Scanner(System.in); System.out.println("Bienvenido a MiApp"); System.out.print("Ingrese la interface IO : Terminal/GUI (1/2): "); int nio = sc.nextInt(); System.out.print("Ingrese la base de datos: Oracle/MySql (1/2): "); int ndb = sc.nextInt(); io = IOFactory.getIO(nio); // conexión con IO db = DBFactory.getDB(ndb); // conexión con DB Producto pro = new Producto(); io.leer(pro); // lee datos para pro db.escribir(pro); // escribe datos de pro } } class Producto{ Producto(){ System.out.println("\nCrea un objeto producto"); } } interface IO{ int leer(Producto pro); } interface DB{ int escribir(Producto pro); // firmas escribe datos de nt } class IOFactory{ // Aplica Polimorfismo para comportarse como IO1 o IO2 public static IO getIO(int nio){ IO io; if(nio==1) io = new IO1(); else io = new IO2(); return io; } } class DBFactory{ // Aplica Polimorfismo para comportarse como DB1 o DB2 public static DB getDB(int ndb){ DB db; if(ndb==1) db = new DB1(); else db = new DB2(); return db; } } class IO1 implements IO{ public int leer(Producto pro) { System.out.println("Lee con Interface IO: Terminal"); return 1; } } class IO2 implements IO{ public int leer(Producto pro) { System.out.println("lee con interface IO: GUI"); return 2; } } class DB1 implements DB{ public int escribir(Producto pro){ System.out.println("Escribe en Base datos : Oracle"); return 1; } } class DB2 implements DB{ public int escribir(Producto pro){ System.out.println("Escribe en Base datos : MySql"); return 2; } }

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