c++/test.cpp
changeset 165 f551b78c3eee
new file mode 100644
--- /dev/null
+++ b/c++/test.cpp
@@ -0,0 +1,49 @@
+#include <cstdio>
+#include <cstdlib>
+
+#define CASEMAX 5
+
+void inittab (int arr[][CASEMAX], int cols)
+{
+    int i, j;
+    for (i = 0; i < cols; i++) {
+        for (j = 0; j < cols; j++) {
+            arr[i][j] = 0;
+        }
+    }
+}
+
+void display (int arr[][CASEMAX], int cols)
+{
+
+    int i, j;
+
+    for (i = 0; i < cols; i++) {
+        printf ("+--");
+        for (j = 0; j < cols; j++)
+            printf ("-----");
+        printf ("--+\n");
+
+        for (j = 0; j < cols; j++) {
+            printf ("|%-4d", arr[i][j]);
+        }
+
+        printf ("|\n");
+    }
+
+    printf ("+--");
+    for (j = 0; j < cols; j++)
+        printf ("-----");
+    printf ("--+\n");
+}
+
+int main (int argc, char **argv)
+{
+    int cols = CASEMAX;
+    int arr[CASEMAX][CASEMAX];
+
+    inittab (arr, cols);
+    display (arr, cols);
+
+    return EXIT_SUCCESS;
+}