aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNataliia Brown <[email protected]>2024-02-15 15:10:12 -0800
committerNataliia Brown <[email protected]>2024-02-15 15:10:12 -0800
commit97e81ebfcfc77fbf9a76b889feac765801a188fa (patch)
treeddfff1e684445fa023f6f0030efd0cef1366463d
parentcreated new project, added main.cpp (diff)
downloadin-class-exercise-11-natabrown-main.tar.xz
in-class-exercise-11-natabrown-main.zip
compiles and is correctHEADmain
-rw-r--r--In class 11/In class 11/main.cpp50
1 files changed, 49 insertions, 1 deletions
diff --git a/In class 11/In class 11/main.cpp b/In class 11/In class 11/main.cpp
index 7bdbc4a..d88e3e1 100644
--- a/In class 11/In class 11/main.cpp
+++ b/In class 11/In class 11/main.cpp
@@ -1,4 +1,52 @@
// Name: Nataliia Brown
// Date: 2/15/24
// Class: CST 116
-// Assignment: In-Class Exercise 11 \ No newline at end of file
+// Assignment: In-Class Exercise 11
+
+#include <iostream>
+#include <ostream>
+
+using std::cout;
+using std::cin;
+using std::endl;
+
+const size_t ROW = 3;
+const size_t COLUMN = 3;
+
+void Print2DArray(int(&matrix)[ROW][COLUMN])
+{
+ for (auto i = 0u; i < ROW; ++i)
+ {
+ for (auto j = 0u; j < COLUMN; ++j)
+ {
+ cout << matrix[i][j] << " ";
+ }
+ cout << endl;
+ }
+ cout << endl;
+
+}
+
+
+int main() {
+
+ int matrix[ROW][COLUMN]{
+ {0,0,0},
+ {0,0,0},
+ {0,0,0}
+ };
+ int x = 0;
+
+ for (auto i = 0u; i < ROW; ++i)
+ {
+ for (auto j = 0u; j < COLUMN; ++j)
+ {
+ ++x;
+ matrix[i][j] = x;
+ }
+ }
+
+ Print2DArray(matrix);
+ return 0;
+}
+