Quadratic Formula code

I have an assignment im working on to calculate the quadratic formula. im getting 2 errors cannot find a match for ostream:operators =<double> which i dont understand because im not even using double and a warning saying a2 is assigned a value never used in function main. can someone please assist me in this matter.

#include <math.h> // Math Library
#include <cmath>
#include <string.h>
#include <iostream.h>

int main()
{
float determ,negative,positive,v1,v2,v3,a2;
string exit= "y";

cout<< "Welcome to my Quadratic Calculator"<<endl;
while (exit != "n")
{
cout<<"Enter the Coefficient A:";
cin>>v1;
cout<<"Enter the Coefficient B:";
cin>>v2;
cout<<"Enter the Coefficient C:";
cin>>v3;
determ = v2*v2-4*v1*v3;

if (determ < 0)
cout<<"The input you have entered is invalid"<<endl;

else
{
a2 = -v2/2*v1;
cout<<"Solution Set is:"<<positive =a2 + sqrt (determ) /2*v1;
cout<<"Solution set is:"<<negative =a2 - sqrt (determ) /2*v1;
}
cout<<"Would You Like to Continue Y or N?";cin>>exit;
cout<<"Thanks For Participating in this Calculation Exercise"<<endl;
}
return 0;
}
Your code should be:

1
2
cout<<"Solution Set is:"<< (a2 + sqrt (determ) /2*v1);
cout<<"Solution set is:"<< (a2 - sqrt (determ) /2*v1);


That is, you don't need an assignment in there. Also, you may need to write 'using namespace std;' after your #include directives.
Thank you so much sir. That worked and it's been driving me crazy. so the assignment to a name is what was giving it the overload i suppose. all i have to do now is work on the loops. Thanks again.
Topic archived. No new replies allowed.