online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
<script> const klucz = 3; const tab = ['A', 'B', 'C', 'D', 'E']; function przesun(start, loop) { // w tym przykładzie brak kontroli czy start jest dozwolonym indeksem // dla danej długości tablicy w tym przypadku od 0 do 4 // 0 1 2 3 4 // ['A', 'B', 'C', 'D', 'E'] // i czy loop jest większe od 0-a // i jaką wielokrotność wielkości tablicy (length) stanowi wartość w klucz // zakładamy, że te wartości w. w. są podawane prawidłowe let index = ((start + klucz) >= tab.length) ? Math.abs(tab.length - (start + klucz)) : (start + klucz); for (let i=0; i<loop; i++) { document.write(tab[index] + '<br>'); index++; if (index > tab.length - 1) index = 0; // lub if (++index > tab.length - 1) index = 0; } document.write('----' + '<br>'); // dla prezentacji } przesun(0, 10); przesun(2, 8); przesun(4, 2); </script>

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