Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. case 2:
  2.  
  3. ofstream zapis;
  4. zapis.open("plik.txt", ios::app);
  5.  
  6. SetConsoleTextAttribute(hConsole,FOREGROUND_RED | FOREGROUND_INTENSITY );
  7.  
  8. float a1,a2,b1,b2,c1,c2,wx,wy,w,x,y;
  9.  
  10. std:: zapis << "METODA WYZNACZNIKOW"<< std::endl<<endl;
  11. std:: zapis <<"Podaj a1: "<< std::endl;
  12. cin>>a1;
  13. std:: zapis <<"Podaj b1: "<< std::endl;
  14. cin>>b1;
  15. std:: zapis <<"Podaj c1: "<< std::endl;
  16. cin>>c1;
  17. std:: zapis <<"Podaj a2: "<< std::endl;
  18. cin>>a2;
  19. std:: zapis <<"Podaj b2: "<< std::endl;
  20. cin>>b2;
  21. std:: zapis <<"Podaj c2: "<< std::endl;
  22. cin>>c2;
  23.  
  24. w = a1*b2 - b1*a2; //wyznacznik główny
  25. wx = c1*b2 - b1*c2;
  26. wy = a1*c2 - c1*a2;
  27.  
  28. if(w!=0) //sprawdzamy, czy główny wyznacznik jest różny od zera
  29. {
  30.  
  31. std:: zapis <<"Zmienna x wynosi = "<<wx/w<< std::endl;
  32. std:: zapis <<"Zmienna y wynosi = "<<wy/w<< std::endl;
  33.  
  34. }
  35.  
  36. else // w tym miejscu sprawdzamy przypadek, gdy główny wyznacznik jest równy 0
  37. if(wx==0&&wy==0)
  38. std:: zapis <<"Uklad ma nieskonczenie wiele rozwiazan"<< std::endl;
  39. else
  40.  
  41. std:: zapis <<"Uklad sprzeczny"<< std::endl;
  42.  
  43. zapis.close();
  44.  
  45. system("PAUSE");
  46.  
  47.  
  48. // break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement