Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main()
- {
- int c,f;
- int x, y;
- int a, b, d, e;
- int det,dx,dy; // Para efeito deste problema
- cout << " |a*x + b*y = c \n-\t\t\t, digite a,b,c,d,e,f\n |d*x + e*y = f \n\n";
- cin >> a >> b >> c >> d >> e >> f;
- x = (c*e - b*f) / (a*e - b*d);
- y = (a*f - c*d) / (a*e - b*d);
- // Cálculo do determinante ... 2 linhas a 2 incógnitas
- det = (a * x) * (e*y) - (d*x) * (b*y);
- dx = c * (e * y) - f * (b *y);
- dy = (a * x) * f - (d * x) * c;
- if (det == 0) // Caso ser 0 , pode ser indeterm. ou impossivel
- if (dx == 0 && dy == 0) // Caso estes forem 0 temos 0x
- cout << "Possível Indeterminado" << endl;
- else
- cout << "Impossível" << endl;
- else
- cout << "\n\nCaso solucao: \n";
- cout << " |x=" << x << endl
- << "- \n"
- << " |y=" << y
- << endl;
- // fiz o programa só que nas situações (restritas a minha funções nos calculos são impedidas) pois dá quociente div 0, o que faço!?.
- cin.clear();
- cin.ignore();
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement