Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Matrix_1
#include <iostream> using namespace std; int main() { //int n = 5; // columns int m = 3; // strings int k = 1; int A[5][3]; // Matrix n x n // Filling matrix n x n with // natural numbers from 1 to n^2 for (int j = 0; j < m; j++) { for (int i = 0; i < m; i++) { A[i][j] = k; //cout << A[i][j] << " " ; k++; } //cout << " " << endl; } // By reason of that string's index always goes // in front of the column's in generally accepted form // of matrix's notation, we will transpose it // We do it mostly for decreasing an amount of errors when myltiplying matrices // A[column][string] int buff = 0; //int corner_elements = (pow(n,2) - n)/2; for (int j = 0; j < m; j++) { for (int i = 0; i < m; i++) { buff = A[i][j]; A[i][j] = A[j][i]; A[j][i] = buff; cout << A[i][j] << " " ; } cout << " " << endl; } /*int c = 0; int p = 1; for (int j = 1; j <= n ; j++) { for (int i = 1; i <= n; i++) { while (p <= n) { c = c + A[p][i] * A[j][p]; } A[i][j] = c; cout « A[i][j] « " " ; k++; } cout « endl; }*/ return 0; }
run
|
edit
|
history
|
help
0
CStringA
du
Removing __unaligned specifier partial solution
dharmesh
bool behaviour (convertion/promotion) for logical and artihmetic operators
7
Copy double[2][3] into vector<vector<double>>
#19
Not Common Numbers
pitch errors verification for Nowhk