Advertisement
dzieciol

równanie liniowe

Sep 22nd, 2014
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 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 a,b;
  8.     float x;
  9.     cout<<"podaj a"<<endl;
  10.     cin>>a;
  11.     cout<<"podaj b"<<endl;
  12.     cin>>b;
  13.     cout<<a<<"x+"<<b<<"=0"<<endl;
  14.     if (a!=0)
  15.     {x=-b/a;
  16.     cout<<"x="<<x<<endl;
  17.    
  18.     }else
  19.     if (b!=0)
  20.     cout<<"rownanie sprzeczne"<<endl;
  21.     else
  22.     cout<<"rownanie ma nieskonczenie wiele rozwiazan"<<endl;
  23.    
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement