Advertisement
Guest User

Untitled

a guest
Mar 14th, 2017
2,687
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.70 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. float a1;
  6. float b1;
  7. float c1;
  8.  
  9. float a2;
  10. float b2;
  11. float c2;
  12.  
  13. float W;
  14. float X;
  15. float Y;
  16.  
  17. float m;
  18. float n;
  19.  
  20.  
  21. //--------
  22. string one;
  23. string two;
  24. //--------
  25.  
  26. int main()
  27. {
  28.     cout << "1. Algorytm oblicza układ równań metodą wyznacznikową" << endl;
  29.     cout << "2. Program nie obsługuje znaków matematycznych, tylko liczby" << endl;
  30.     cout << "3. Jako przecinków w liczbach dziesiętnych używaj KROPEK" << endl;
  31.     cout << "4. Aby zapisać mnożenie użyj GWIAZDKI, żeby zapisać potęgę użyj ^x, żeby dzielić użyj /" << endl;
  32.     cout << "5. Po uzupełnieniu każdego pola i upewnieniu się że pole jest poprawnie wypełnione naciśnij ENTER"<< endl<< endl;
  33.  
  34.     cout << "Po zapoznaniu się z instrukcjami naciśnij ENTER" <<endl <<endl;
  35.     cin.get();
  36.     cout << "================================================"<<endl<<endl;
  37.  
  38.  
  39.     cout << "Uzupełnij równanie"<<endl<<endl;
  40.     cout << "#1  ,- ";
  41.     cin >> one;
  42.     cout << "    |"<<endl;
  43.     cout << "   {"<<endl;
  44.     cout << "    |"<<endl;
  45.     cout << "#2  '- ";
  46.     cin >> two;
  47.  
  48.     cout <<""<<endl<<endl;
  49.  
  50.     cout << "Uzupełnij dane"<<endl;
  51.     cout << "Uzupełniaj tylko za pomocą liczb dziesiętnych"<<endl<<endl;
  52.     cout << "Równanie #1"<<endl;
  53.  
  54.  
  55.     cout << "ax = ";
  56.     cin >> a1; cout <<""<<endl;
  57.  
  58.     cout << "by = ";
  59.     cin >> b1; cout <<""<<endl;
  60.  
  61.     cout << "c = ";
  62.     cin >> c1; cout<<""<<endl;
  63.  
  64.  
  65.     cout << "Równanie #2"<<endl;
  66.  
  67.  
  68.  
  69.     cout << "ax = ";
  70.     cin >> a2; cout <<""<<endl;
  71.  
  72.     cout << "by = ";
  73.     cin >> b2; cout <<""<<endl;
  74.  
  75.     cout << "c = ";
  76.     cin >> c2; cout<<""<<endl<<endl;
  77.  
  78.     W = (a1*b2)-(a2*b1);
  79.     X = (c1*b2)-(c2*b1);
  80.     Y = (a1*c2)-(a2*c1);
  81.     m = X/W;
  82.     n = Y/W;
  83.  
  84.     if (W != 0)
  85.     {
  86.     cout << "==============================="<<endl<<endl;
  87.     cout << "Istnieje rozwiązanie"<<endl;
  88.     cout << "x = "; cout << m<<endl;
  89.     cout << "y = "; cout << n<<endl<<endl;
  90.     cout << "==============================="<<endl<<endl<<endl<<endl;
  91.     cin.get();
  92.     }
  93.  
  94.     if (W == 0 && X != 0 || Y != 0)
  95.     {
  96.     cout << "==============================="<<endl<<endl;
  97.     cout << "Zbiór nie ma rozwiązania"<<endl;
  98.     cout << "Zbiór jest sprzeczny"<<endl<<endl;
  99.     cout << "==============================="<<endl<<endl<<endl<<endl;
  100.     cin.get();
  101.     }
  102.  
  103.  
  104.     if (W == 0 && X == 0 && Y == 0)
  105.     {
  106.     cout << "==============================="<<endl<<endl;
  107.     cout << "Zbiór ma nieskończenie wiele rozwiązań"<<endl<<endl;
  108.     cout << "==============================="<<endl<<endl<<endl<<endl;
  109.     cin.get();
  110.     }
  111.  
  112.     cout << "Autor Tomek Prabucki";
  113.     return 0;
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement