so my goal here is to write program that solves quadratic equations. But the values corresponding to a, h, and k must be whole numbers While the value of x must be a double precision real number with two decimal digit.
My problem occurs when I run the ints through the formula it just return me whole numbers. I know that if i change the ints from ints into doubles the program runs correctly but my professor wants them to be Whole numbers .
#include <iostream>
#include <cmath>
#include <typeinfo>
#include <iomanip>
#include <string>
using namespace std;
int main( )
{
int a = 3,h = 4,k = 5 ;
double x1;
x1 = -h + sqrt(k/a);
x1 = round(x1*100.00)/100.00;
cout << "The solutions for the equation are: " << endl << " " << "x1: " <<setprecision(2) << fixed << x1;
}