Guest User

Clase Matriz

a guest
Jul 25th, 2010
646
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <iomanip>
  4.  
  5. using namespace std;
  6.  
  7. #include "Matriz.h"
  8.  
  9. int main() {
  10.  
  11.     system ("clear");
  12.  
  13.     Matriz a, b, c, d, e; //Declara los objetos de la clase Matriz
  14.  
  15.     // Inicializa la matriz w
  16.    
  17.     int j, n=3;
  18.  
  19.     double **w;
  20.    
  21.     w = new double* [n];
  22.    
  23.     for (j = 0; j < n; j++)
  24.  
  25.         w[j] = new double [n];
  26.  
  27.    
  28.         w[0][0]=1, w[0][1]=2, w[0][2]=3,
  29.         w[1][0]=2, w[1][1]=1, w[1][2]=4,
  30.         w[2][0]=3, w[2][1]=4, w[2][2]=1;
  31.  
  32.     a.initMatriz(w);
  33.  
  34.     cout << "\nEsta es la matriz original\n" << a;
  35.  
  36.     b.invermat(w);
  37.  
  38.     cout << "\nEsta es la matriz inversa\n" << b;
  39.  
  40.     c = a * b; // Esto debe dar la matriz identidad
  41.  
  42.     cout << "\nEsta es la matriz identidad\n" << c;
  43.  
  44.  
  45.     return 0;
  46.  
  47. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×