Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- case 2:
- ofstream zapis;
- zapis.open("plik.txt", ios::app);
- SetConsoleTextAttribute(hConsole,FOREGROUND_RED | FOREGROUND_INTENSITY );
- float a1,a2,b1,b2,c1,c2,wx,wy,w,x,y;
- std:: zapis << "METODA WYZNACZNIKOW"<< std::endl<<endl;
- std:: zapis <<"Podaj a1: "<< std::endl;
- cin>>a1;
- std:: zapis <<"Podaj b1: "<< std::endl;
- cin>>b1;
- std:: zapis <<"Podaj c1: "<< std::endl;
- cin>>c1;
- std:: zapis <<"Podaj a2: "<< std::endl;
- cin>>a2;
- std:: zapis <<"Podaj b2: "<< std::endl;
- cin>>b2;
- std:: zapis <<"Podaj c2: "<< std::endl;
- cin>>c2;
- w = a1*b2 - b1*a2; //wyznacznik główny
- wx = c1*b2 - b1*c2;
- wy = a1*c2 - c1*a2;
- if(w!=0) //sprawdzamy, czy główny wyznacznik jest różny od zera
- {
- std:: zapis <<"Zmienna x wynosi = "<<wx/w<< std::endl;
- std:: zapis <<"Zmienna y wynosi = "<<wy/w<< std::endl;
- }
- else // w tym miejscu sprawdzamy przypadek, gdy główny wyznacznik jest równy 0
- if(wx==0&&wy==0)
- std:: zapis <<"Uklad ma nieskonczenie wiele rozwiazan"<< std::endl;
- else
- std:: zapis <<"Uklad sprzeczny"<< std::endl;
- zapis.close();
- system("PAUSE");
- // break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement