I would like to know if this is a correct way to call and define a function for my program
#include <iostream>
#include <cmath>
using namespace std;
int math(double a, double b, double c);
int main( )
{
int math;
char a,b,c;
math = a + b + c;
return (0);
}
int math()
{
char ans = 'y';
bool quad_answer = false;
do {
double a, b, c;
cout << "Enter the value of a: ";
cin >> a;
cout << "Enter the value of b: ";
cin >> b;
cout << "Enter the value of c: ";
cin >> c;
double discriminant = (pow(b,2) - 4*a*c);
double positive_root = (((-b) + sqrt(discriminant))/(2*a));
double negative_root = (((-b) - sqrt(discriminant))/(2*a));
if (discriminant == 0)
{
cout << "\n\ndiscriminant ";
cout << discriminant << endl;
cout << "So there is one real root valued at.\n\n";
}
else if (discriminant < 0)
{
cout << "\n\ndiscriminant ";
cout << discriminant << endl;
cout << "So there is two complex roots.\n\n";
}
else
{
cout << "\n\ndiscriminant ";
cout << discriminant << endl;
cout << "So there are two real roots valued at.\n\n";
}
cout << "The roots of the quadratic equation are x = ";
cout << negative_root;
cout << ", ";
cout << positive_root << endl<< endl;
if (quad_answer) cout << endl;
cout << "Continue (y/n)? ";
cin >> ans;
} while (ans == 'y');
return 0;
}