online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> #include <iomanip> #include <cstdlib> #include <ctime> #include <functional> using namespace std; const int MATRIX_ROW_COUNT = 5; const int MATRIX_COL_COUNT = 4; void FillRandomMatrix(int matrix[][MATRIX_COL_COUNT]) { for (int i = 0; i < MATRIX_ROW_COUNT; i++) { for (int j = 0; j < MATRIX_COL_COUNT; j++) { matrix[i][j] = rand() % 100; } } } void PrintMatrix(int matrix[][MATRIX_COL_COUNT]) { for (int i = 0; i < MATRIX_ROW_COUNT; i++) { for (int j = 0; j < MATRIX_COL_COUNT; j++) { cout << setw(5) << matrix[i][j] << " "; } cout << "\n"; } } void move(int matrix[][MATRIX_COL_COUNT], int n, int m, int k) { int buf = 0; for (int i = 0; i < n; i++) { for (int t = 0; t < k % n; t++) { buf = matrix[i][m - 1]; for (int j = m - 1; j > 0; j--) { matrix[i][j] = matrix[i][j - 1]; } matrix[i][0] = buf; } } } int main() { srand(time(NULL)); int matrix[MATRIX_ROW_COUNT][MATRIX_COL_COUNT]; FillRandomMatrix(matrix); PrintMatrix(matrix); move(matrix, MATRIX_ROW_COUNT, MATRIX_COL_COUNT, 2); cout << "\nResult:\n"; PrintMatrix(matrix); return 0; }

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