-
-
Save kdmkdmkdm/2466309 to your computer and use it in GitHub Desktop.
c++
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // matrixAddition | |
| #include "stdafx.h" | |
| #include <iostream> | |
| using namespace std; | |
| int main() | |
| { | |
| int matrixA[2][3] = | |
| { | |
| {-5, 2, 8}, | |
| {1, 0, 0} | |
| }; | |
| // I would like my output to be in the format of: | |
| // A = | |
| // -5 2 8 | |
| // 1 0 0 | |
| cout << "A =" << endl; | |
| cout << matrixA[0][0] << " " << matrixA[0][1] << " " << matrixA[0][2] << endl; | |
| cout << matrixA[1][0] << " " << matrixA[1][1] << " " << matrixA[1][2] << endl << endl; | |
| int matrixB[2][3] = | |
| { | |
| {1, 0, 2}, | |
| {0, 3, -6} | |
| }; | |
| // I would like my output to be in the format of: | |
| // B = | |
| // 1 0 2 | |
| // 0 3 -6 | |
| cout << "B =" << endl; | |
| cout << matrixB[0][0] << " " << matrixB[0][1] << " " << matrixB[0][2] << endl; | |
| cout << matrixB[1][0] << " " << matrixB[1][1] << " " << matrixB[1][2] << endl; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment