online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <iostream> using namespace std; int main() { int length =0; cin >> length; unsigned char *ARR = new unsigned char[length]; for (int j = 0; j < length; j++) { cin >> ARR[j]; } int sumS[6]{}; int sumN[6]{}; int n = 0; for (int j = 0; j < length; j++) { if (ARR[j - 1] != '1' && ARR[j + 1] != '1' && ARR[j] == '1') { sumS[0] += 1; } if (ARR[j - 1] != '1' && ARR[j] == '1' && ARR[j] == ARR[j + 1] && ARR[j + 2] != '1') { sumS[1] += 1; } if (ARR[j - 1] != '1' && ARR[j] == '1' && ARR[j] == ARR[j + 1] && ARR[j] == ARR[j + 2] && ARR[j + 3] != '1') { sumS[2] += 1; } if (ARR[j - 1] != '1' && ARR[j] == '1' && ARR[j] == ARR[j + 1] && ARR[j] == ARR[j + 2] && ARR[j] == ARR[j + 3] && ARR[j + 4] != '1') { sumS[3] += 1; } if (ARR[j - 1] != '1' && ARR[j] == '1' && ARR[j] == ARR[j + 1] && ARR[j] == ARR[j + 2] && ARR[j] == ARR[j + 3] && ARR[j] == ARR[j + 4] && ARR[j + 5] != '1') { sumS[4] += 1; } n++; if (ARR[j - 1] != '1' && ARR[j] == '1' && ARR[j] == ARR[j + 1] && ARR[j] == ARR[j + 2] && ARR[j] == ARR[j + 3] && ARR[j] == ARR[j + 4] && ARR[j] == ARR[j + 5] && ARR[j] == ARR[j + 6] && ARR[j] == ARR[j + n]) { sumS[5] += 1; } else n = 0; if (ARR[j - 1] != '0' && ARR[j + 1] != '0' && ARR[j] == '0') { sumN[0] += 1; } if (ARR[j - 1] != '0' && ARR[j] == '0' && ARR[j] == ARR[j + 1] && ARR[j + 2] != '0') { sumN[1] += 1; } if (ARR[j - 1] != '0' && ARR[j] == '0' && ARR[j] == ARR[j + 1] && ARR[j] == ARR[j + 2] && ARR[j + 3] != '0') { sumN[2] += 1; } if (ARR[j - 1] != '0' && ARR[j] == '0' && ARR[j] == ARR[j + 1] && ARR[j] == ARR[j + 2] && ARR[j] == ARR[j + 3] && ARR[j + 4] != '0') { sumN[3] += 1; } if (ARR[j - 1] != '0' && ARR[j] == '0' && ARR[j] == ARR[j + 1] && ARR[j] == ARR[j + 2] && ARR[j] == ARR[j + 3] && ARR[j] == ARR[j + 4] && ARR[j + 5] != '0') { sumN[4] += 1; } n++; if (ARR[j - 1] != '0' && ARR[j] == '0' && ARR[j] == ARR[j + 1] && ARR[j] == ARR[j + 2] && ARR[j] == ARR[j + 3] && ARR[j] == ARR[j + 4] && ARR[j] == ARR[j + 5] && ARR[j] == ARR[j + 6] && ARR[j] == ARR[j + n]) { sumN[5] += 1; } else n = 0; } for (int i = 0; i < 6; i++) { cout << " Серия " << i + 1 << " |1| " << sumS[i] << " |0| " << sumN[i] << endl; } }

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