Algebra: Solve Quadratic Equations
The code has been modified slightly and now uploaded to the site.

31.cpp
#include <iostream>
#include <math.h>
using namespace std;
int main(){
double a;
double b;
double c;
double part1;
double part2;
double r1;
double r2;
std::cout << "Enter a, b, c: \n";
std::cin >> a;
std::cin >> b;
std::cin >> c;
part1 = pow(b, 2) - 4 * a * c;
if (part1 == 0){
part2 = -b + pow(part1, 0.5);
r1 = part2 / (2 * a);
std::cout << "The root is " << r1 << "\n";
}
else if (part1 > 0){
part2 = -b + pow(part1, 0.5);
r1 = part2 / (2 * a);
part2 = -b - pow(part1, 0.5);
r2 = part2 / (2 * a);
std::cout << "The roots are " << r1 << " and " << r2 << "\n";
}
else
std::cout << "The equation has no real roots\n";
}