You are on page 1of 2

// TEMA 1

#include "pch.h"
#include <iostream>
#include <stdlib.h>
using namespace std;

int main()
{
int a1, b1, c1, a2, b2, c2, ds, dx, dy;
float x, y;
cout << "| a1*x + b1*x=c1 \n|\n| a2*x + b2*x=c2\n";
cout << "a1=";
cin >> a1;

cout << "b1=";


cin >> b1;

cout << "c1=";


cin >> c1;

cout << "a2=";


cin >> a2;

cout << "b2=";


cin >> b2;

cout << "c2=";


cin >> c2;

ds = (a1*b2 - b1 * a2);
dx = (b2*c1 - b1 * c2);
dy = (a1*c2 - a2 * c1);

if (ds == 0)
if (dx == 0)
cout << "Sistem nedeterminat";
else
cout << "Sistem incompatibil";
else {
x = dx / ds;
y = dy / ds;
cout << "x=" << x << endl;
cout << "y=" << y << endl;

return 0;
}

You might also like