Advertisement
Grigorian

Równanie liniowe(dokonczyc)

Sep 22nd, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  5.  
  6. int main(int argc, char** argv) {
  7.         float a1,a2,b1,b2,c1,c2,w,wx,wy,x,y;
  8.        
  9.         cout<<"podaj a1,b1,c1"<<endl;
  10.         cin>>a1;
  11.         cin>>b1;
  12.         cin>>c1;
  13.         cout<<"podaj  a2,b2,c2"<<endl;
  14.         cin>>a2;
  15.         cin>>b2;
  16.         cin>>c2;
  17.         cout<<"Równanie ma postać"<<endl;
  18.         cout<<a1<<"x"<<"+"<<b1<<"y"<<"="<<c1<<endl;
  19.         cout<<a2<<"x"<<"+"<<b2<<"y"<<"="<<c2<<endl;
  20.  
  21.         w=(a1*b2) - (a2*b1);
  22.         wx=(c1*b2)-(c2*b1);
  23.         wy=(a1*c2)-(a2*c1);
  24.        
  25.         cout<<"W="<<w<<endl;
  26.         cout<<"Wx="<<wx<<endl;
  27.         cout<<"Wy="<<wy<<endl;
  28.          
  29.      // if (w=!0)
  30.         { x=wx/w;
  31.          y=wy/w;
  32.         cout<<x<<endl;
  33.         cout<<y<<endl;}
  34.        
  35.        
  36.  
  37.  
  38.        
  39.         return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement