Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double ratio=1, det;
- for(int i = 0; i < n; i++)
- {
- for(int j = 0; j < n; j++)
- {
- if(j>i)
- { // ha az elem 0 , akkor sor csere
- if (abs(a[i][i]) < pow(10,-15))
- {
- for(int j = 0; j < n; ++j)
- {
- double s = a[i][j];
- a[i][j] = a[i+1][j];
- a[i+1][j] = s;
- }
- }
- ratio = a[j][i]/a[i][i];
- for(int k = 0; k < n; k++)
- {
- a[j][k] -= ratio * a[i][k];
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement