diff options
Diffstat (limited to 'C++/2D Arrays/2D Arrays.cpp')
-rw-r--r-- | C++/2D Arrays/2D Arrays.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/C++/2D Arrays/2D Arrays.cpp b/C++/2D Arrays/2D Arrays.cpp new file mode 100644 index 0000000..d18f148 --- /dev/null +++ b/C++/2D Arrays/2D Arrays.cpp @@ -0,0 +1,44 @@ +// Name: msglm +// Date: Nov 25th 2022 +// Program Name: 2D Arrays +// Description: + + +#include <iostream> +#include <string> +using namespace std; + +//classes +class Person { + public: + string movies[2][4]; + void getMovies() { + cout << "Enter your favorite movies: \n"; + for(int x = 0; x < 2; x++) { + for(int y = 0; y < 4; y++) { + cout << "This will be going in position: (" << x << "," << y << ")\n"; + getline(cin,movies[x][y]); + } + } + } + void output() { + for(int x = 0; x < 2; x++) { + for(int y = 0; y < 4; y++) { + cout << movies[x][y] << endl; + } + } + } +}; + +int main() { + Person person; + person.getMovies(); + person.output(); +} +/* + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License Version 3 ONLY as published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. + */ |