CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//#include <credit>
//Thanks Krow, and others, for helping me understand this.
#include <iostream>
using namespace std;
class Grid {
public:
//Grid Constructor
Grid(int w, int h) : width(w), height(h) {
cout << "[New Grid Created]" << endl;
data = new char*[width];
int x;
int y;
for(x=0; x<width; x++) {
data[x] = new char[height];
for(y=0; y<height; y++) {
data[x][y] = '+';
}
}
}
//Grid Deconstructor
~Grid() {
for(int x=0; x<width; ++x) {
delete[] data[x];
}
delete[] data;
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run