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. *******************************************************************************/ public class Main { public static boolean matchPattern(String str,String pattern){ int patternLength = pattern.length(); int patternSum = 0; int[] patternSumArray = new int[(str.length() - patternLength)+1]; int patternSumArrayIndex = 0; int patternSumToCheck = 0; String toCompare = ""; int backIndex = 0; int forthIndex = pattern.length(); for(int i=0; i<pattern.length();i++){ patternSumToCheck = patternSumToCheck + pattern.charAt(i); patternSum = patternSum + str.charAt(i); } patternSumArray[patternSumArrayIndex] = patternSum; patternSumArrayIndex++; for(int i=0; forthIndex<str.length();i++){ patternSum = patternSum + str.charAt(forthIndex) - str.charAt(backIndex); forthIndex++; backIndex++; patternSumArray[patternSumArrayIndex] = patternSum; patternSumArrayIndex++; } for(int i=0; i<patternSumArray.length;i++){ if(patternSumArray[i] == patternSumToCheck){ toCompare = ""; for(int j=i; j<(i+pattern.length());j++){ toCompare = toCompare + str.charAt(j); } if(toCompare.equals(pattern)){ return true; } } } return false; } public static void main(String[] args) { String str = "cdxabie"; String pattern = "bie"; System.out.println(matchPattern(str, pattern)); } }

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