Okay, I'm developing a program that will solve quadratic equations for users. I have them plug in values for a, b, and c in the following formula: ax^2 + bx +c. This formula probably looks familiar to you guys from highschool. Anyways, for some reason my code outputs completely inaccurate results. Here is my code:

#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

int main()
//variable declarations

int aval;
int bval;
int cval;
int root;
int preroot;
double sol1;
double sol2;

//a user inputs an integer for each of the specified values

cout<< "a = ";
cin >> aval;
cout<<"b = ";
cout<<"c = ";

//number crunching

sol1 = (-bval + sqrt(bval*bval - 4*aval*cval))/(2*aval);
sol2 = (-bval - sqrt(bval*bval - 4*aval*cval))/(2*aval);


cout<<"Your solutions are: x = ";
cout<<" or x = ";
cout<<sol2<< endl;
return 0;

For example, the equation 4x^2 + 5x + 1 comes up with x = -4 and x = -16 when the answers are clearly -1 and -1/4. I'm probably making some really stupid mistake or maybe i messed up the formula but i can't seem to figure it out! Anyways, some help would be nice. And please be gentle i'm new to this. Thanks!

PS. I'm plugging the user input into the quadratic formula just in case you were confused. The quadratic formula can be found here: http://mste.illinois.edu/exner/ncsa/quad/