Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<math.h>
- using namespace std;
- int kwadratowa(float a,float b,float c)
- {
- float delta;
- float wynik1,wynik2;
- if(!a)
- {
- cout<<"To nie jest funkcja kwadratowa."<<endl;
- }
- else{ delta=(pow(b,2))-(4*a*c);
- if(delta==0)
- { wynik1=(-b) /2*a;
- cout<<"Wynikiem rownania jest: "<<wynik1;
- }
- else if (delta>0)
- { wynik1=(sqrt(delta)-b )/(2*a);
- wynik2=(-(sqrt(delta))-b )/(2*a);
- cout<<"Wynikiem rowania jest: "<<wynik1<<" i "<<wynik2;
- }
- else
- {
- cout<<"Rownanie nie ma rozwiazania w zbiorze liczb rzeczywistych."<<endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement