AlbertMourato

Untitled

Nov 27th, 2015
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #include <iostream>
  3. using namespace std;
  4. int main(){
  5.     double a, b, c, delta, aux;
  6.     cin>>a;
  7.     cin>>b;
  8.     cin>>c;
  9.     if(a==0) cout<<"NEESG\n";
  10.     else{
  11.         delta = ((b*b)-(4*a*c));
  12.         if(delta<0){
  13.             cout<<"NRR\n";
  14.         }else{
  15.             if(delta==0){
  16.                 aux = ((-1*b)+ sqrt(delta))/(2*a);
  17.                 cout << setiosflags (ios::fixed) << setprecision (2)<< aux<<"\n";
  18.             }else{
  19.                 aux = ((-1*b)+ sqrt(delta))/(2*a);
  20.                 cout << setiosflags (ios::fixed) << setprecision (2)<< aux<<"\n";
  21.                 aux = ((-1*b)-sqrt(delta))/(2*a);
  22.                 cout << setiosflags (ios::fixed) << setprecision (2)<<aux <<"\n";
  23.             }
  24.         }
  25.     }
  26.     // cout << setiosflags (ios::fixed) << setprecision (2)<< <<"\n";
  27. }
Advertisement
Add Comment
Please, Sign In to add comment