Interactive C++ matrix simulator with a visual grid, online code execution, and matrix output visualization.
This project allows users to generate a matrix grid, write or edit C++ code, execute the code online, and visualize the resulting matrix directly in the browser.
https://bilalzamilahmed.page/matrix-simulator/If the project is hosted under the original GitHub Pages domain, use:
https://bilalcodes1.github.io/matrix-simulator/Dynamic C++ Matrix Simulator is an educational web application designed to help students understand matrix operations in C++ through visual interaction.
The user can choose the number of rows and columns, generate an initial matrix, edit the C++ code, run it using an online compiler API, and then see the output matrix visually.
The project is useful for learning how matrix data changes after applying C++ logic.
The simulator connects three learning parts together:
-
Visual Grid Shows the matrix as colored cells.
-
C++ Code Editor Allows the user to write or modify C++ code.
-
Output Visualization Reads the program output and displays the final matrix visually.
- Dynamic matrix size control
- Custom rows and columns
- Automatic initial matrix generation
- Visual grid display
- Built-in C++ code editor
- Default C++ starter code generation
- Online C++ execution
- Matrix output parsing
- Result matrix display
- Initial matrix display
- Error handling for compile/runtime issues
- Reset button
- Responsive design
- Footer with developer information and social links
- Built using HTML, CSS, and JavaScript
- Uses Wandbox API for online C++ compilation
- The user chooses the matrix size.
- The app generates a matrix filled with values starting from
1. - A default C++ code template is inserted into the editor.
- The user edits the C++ logic.
- The app sends the code to the Wandbox online compiler API.
- The program output is parsed.
- The first expected matrix values are extracted from the output.
- The result is displayed as a visual matrix.
For a 3 × 3 matrix, the initial matrix is:
1 2 3
4 5 6
7 8 9The user can modify the C++ code to change the values, reorder them, rotate the matrix, reverse rows, or apply any custom logic.
The simulator automatically creates a starter C++ program based on the selected matrix size.
Example:
#include <iostream>
#include <vector>
#include <utility>
int main() {
const int ROWS = 3;
const int COLS = 3;
int matrix[ROWS][COLS];
int counter = 1;
for (int i = 0; i < ROWS; i++) {
for (int j = 0; j < COLS; j++) {
matrix[i][j] = counter++;
}
}
// Your logic here
for (int i = 0; i < ROWS; i++) {
for (int j = 0; j < COLS; j++) {
std::cout << matrix[i][j] << " ";
}
std::cout << std::endl;
}
return 0;
}This project can be used to practice:
- 2D arrays in C++
- Matrix traversal
- Nested loops
- Matrix transformations
- Row and column operations
- Array indexing
- Output formatting
- Debugging matrix logic
- Visualizing algorithm results
| Category | Technology |
|---|---|
| Structure | HTML5 |
| Styling | CSS3 |
| Logic | JavaScript |
| Online Compiler | Wandbox API |
| Language Executed | C++ |
| Hosting | GitHub Pages |
Displays the matrix as colored cells. Each value is shown inside a grid cell, making the matrix easier to understand visually.
Allows the user to choose:
- Number of rows
- Number of columns
The app then generates a new matrix based on the selected size.
A text area where the user can edit the generated C++ code.
Sends the C++ code to the online compiler and waits for the result.
Resets the simulator to a fresh generated matrix and default C++ code.
Displays:
- Initial matrix
- Result matrix
- Compile errors
- Runtime errors
- Output parsing errors
matrix-simulator/
├── index.html
└── README.mdThe current version is built as a single-page static web application.
- Clone the repository:
git clone https://github.com/bilalcodes1/matrix-simulator.git- Open the project folder:
cd matrix-simulator- Open
index.htmlin your browser.
No installation or build step is required.
Note: Code execution requires internet access because the project uses the Wandbox API.
This project uses the Wandbox online compiler API:
https://wandbox.org/api/compile.jsonThe code is sent as JSON, compiled online, and the program output is returned to the browser.
- Requires internet access for code execution.
- Output must contain enough numbers to fill the selected matrix.
- The simulator reads the first expected amount of numbers from the program output.
- It is intended for educational examples, not secure production code execution.
- Large or complex programs may fail depending on API limitations.
cpp
matrix-simulator
javascript
html
css
online-compiler
wandbox-api
code-visualizer
matrix-visualization
university-project
github-pages- Add predefined matrix algorithms
- Add rotation examples
- Add transpose visualization
- Add row/column swap animation
- Add matrix search visualization
- Add step-by-step execution mode
- Add syntax highlighting
- Add dark mode
- Add Arabic interface option
- Add local examples library
- Add explanation panel for each algorithm
The purpose of this project is to make C++ matrix practice more visual and interactive.
It helps students see how their code changes the matrix instead of only reading console output.
This makes it useful for:
- Programming practice
- University exercises
- C++ 2D array learning
- Matrix algorithm visualization
- Beginner-friendly coding demonstrations
Bilal Zamil Ahmed Computer Science Student University of Anbar
GitHub: @bilalcodes1 YouTube: Bilal Codes
Educational project — All rights reserved © 2026 Bilal Zamil Ahmed.