Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <math.h>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- using namespace std;
- int main(int argc, char** argv) {
- int a,b,c;
- cout<<"Podaj a:";
- cin>>a;
- cout<<"Podaj b:";
- cin>>b;
- cout<<"Podaj c:";
- cin>>c;
- cout<<a<<"a^2+"<<b<<"x+"<<c<<"0\n";
- cout<<"Delta="<<b*b-4*a<<endl;
- int delta=b*b-4*a*c;
- if(delta<0)
- {
- cout<<"Brak rozwiazan\n";
- return 0;
- }
- if(delta==0)
- {
- cout<<"Jest jedno rozwiazanie\n\n";
- cout<<"x1="<<(-b-sqrt(delta))/(2*a);
- return 0;
- }
- cout<<"\n";
- cout<<"x1="<<(-b-sqrt(delta))/(2*a);
- cout<<"\n";
- cout<<"x2="<<(-b+sqrt(delta))/(2*a);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement