Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.53 KB | None | 0 0
  1.  double ratio=1, det;
  2.     for(int i = 0; i < n; i++)
  3.     {
  4.         for(int j = 0; j < n; j++)
  5.     {
  6.             if(j>i)
  7.         {     // ha az elem 0 , akkor sor csere
  8.               if (abs(a[i][i]) < pow(10,-15))
  9.           {
  10.             for(int j = 0; j < n; ++j)
  11.             {
  12.               double s = a[i][j];
  13.               a[i][j] = a[i+1][j];
  14.               a[i+1][j] = s;
  15.             }
  16.           }
  17.             ratio = a[j][i]/a[i][i];
  18.                 for(int k = 0; k < n; k++)
  19.         {
  20.                     a[j][k] -= ratio * a[i][k];
  21.                 }
  22.             }
  23.         }
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement