All pastes #739271 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-10-17 00:21 UTC
rendered paste body
#include <iostream>
#include <math.h>

using namespace std;
//Variables, Constants, etc...

float r1, r2, e4, a, b, neg_b, c, e, e2, e3; //Final answer with decimal
 //Extra variable space


int main()
{
    cout << "Enter the number for the variables a, b, c.\n";// Assign variables numbers
    cout << "A: ";
    cin >> a;
    cout << "B: ";
    cin >> b;
    cout << "C: ";
    cin >> c;
    cout << "\nWarning: Program will abort if the root Does Not Exist!\n";
    system("PAUSE");
    //To the mathmatical operations!
    neg_b = -b;
    e3 = pow(b,2);
    e = (e3)-(-4*a*c);   
    //assert(e <= -1);
    e2 = pow(e,.5);
    r1 = (neg_b + e2)/(2 * a);
    r2 = (neg_b - e2)/(2 * a);
    cout << "\nThe roots are: " << r1 << " and " << r2 << ".\n";
    system("PAUSE");
}