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.Arrays; import java.util.List; import java.util.Map; import java.util.TreeMap; import java.util.stream.Collectors; class TreeNode implements Comparable<TreeNode> { String name; TreeNode parent; int level = -1; Map<String, TreeNode> children; public TreeNode(String name) { this.name = name; this.children = new TreeMap<>(); } public TreeNode addChild(String child) { TreeNode childNode = new TreeNode( child ); childNode.level = this.level + 1; if (children.containsKey( child )) { childNode = this.children.get( child ); } else { this.children.put( child, childNode ); } childNode.setParent( this ); return childNode; } public void setParent(TreeNode parent) { this.parent = parent; } @Override public int compareTo(TreeNode o) { return this.name.compareTo( o.name ); } @Override public String toString() { return this.name + "\n" + children.values().stream() .map( treeNode -> " ".repeat( 3 * (treeNode.level) ) + treeNode ) .collect( Collectors.joining() ); } } public class Main { public static void main(String[] args) { List<String> list = Arrays.asList( "Primero1/Segundo1/Tercero2/Cuarto1/Quinto1", "Primero1/Segundo2/Tercero2/Cuarto2/Quinto2/Sexto1", "Primero3/Segundo1/Tercero1", "Primero1/Segundo2/Tercero3/Cuarto4/Quinto3/Sexto1/Septimo1", "Primero3/Segundo3/Tercero1", "Primero1/Segundo3/Tercero2", "Primero3/Segundo2/Tercero3", "Primero1/Segundo3/Tercero3", "Primero2/Segundo1/Tercero1", "Primero2/Segundo1/Tercero2", "Primero1/Segundo1/Tercero3", "Primero2/Segundo2/Tercero1", "Primero1/Segundo3/Tercero1", "Primero2/Segundo2/Tercero2", "Primero2/Segundo2/Tercero3", "Primero2/Segundo3/Tercero1", "Primero2/Segundo3/Tercero2", "Primero1/Segundo1/Tercero1", "Primero2/Segundo1/Tercero3", "Primero2/Segundo3/Tercero3", "Primero3/Segundo1/Tercero2", "Primero3/Segundo1/Tercero3/Cuarto5", "Primero3/Segundo2/Tercero1", "Primero3/Segundo2/Tercero2", "Primero1/Segundo2/Tercero1", "Primero3/Segundo3/Tercero2", "Primero3/Segundo3/Tercero3" ); TreeNode root = new TreeNode( "" ); for (String s : list) { String[] strings = s.split( "/" ); TreeNode child = root; for (String st : strings) { child = child.addChild( st ); } } System.out.println( root ); } }

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