diff options
| author | Nataliia Brown <[email protected]> | 2024-02-15 15:10:12 -0800 |
|---|---|---|
| committer | Nataliia Brown <[email protected]> | 2024-02-15 15:10:12 -0800 |
| commit | 97e81ebfcfc77fbf9a76b889feac765801a188fa (patch) | |
| tree | ddfff1e684445fa023f6f0030efd0cef1366463d /In class 11 | |
| parent | created new project, added main.cpp (diff) | |
| download | in-class-exercise-11-natabrown-main.tar.xz in-class-exercise-11-natabrown-main.zip | |
Diffstat (limited to 'In class 11')
| -rw-r--r-- | In class 11/In class 11/main.cpp | 50 |
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; +} + |