Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- discriminate = (b*b) - (4*a*c);
- if (discriminate == 0){
- cout << "There are two repeated roots." << endl;
- roota = (-b+sqrt(discriminate))/(2*a);
- cout << "Root1: " << roota << endl;
- rootb = (-b+sqrt(discriminate))/(2*a);
- cout << "Root2: " << rootb << endl;
- }elseif (discriminate > 0){
- cout << "There are two real roots."<< endl;
- roota = (-b+sqrt(discriminate))/(2*a);
- cout << "Root1: " << roota << endl;
- rootb = (-b+sqrt(discriminate))/(2*a);
- cout << "Root2: " << rootb << endl;
- }else{
- cout << "There are two imaginary roots."<< endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement