Advertisement
89yoyos

afscsasdsfas

Mar 20th, 2014
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. discriminate = (b*b) - (4*a*c);
  2. if (discriminate == 0){
  3.     cout << "There are two repeated roots." << endl;
  4.     roota = (-b+sqrt(discriminate))/(2*a);
  5.     cout << "Root1: " << roota << endl;
  6.     rootb = (-b+sqrt(discriminate))/(2*a);
  7.     cout << "Root2: " << rootb << endl;
  8. }elseif (discriminate > 0){
  9.     cout << "There are two real roots."<< endl;
  10.     roota = (-b+sqrt(discriminate))/(2*a);
  11.     cout << "Root1: " << roota << endl;
  12.     rootb = (-b+sqrt(discriminate))/(2*a);
  13.     cout << "Root2: " << rootb << endl;
  14. }else{
  15.     cout << "There are two imaginary roots."<< endl;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement