1. ## Help on quadratic formula DOS program

Hate to do double threads but I felt this was a totally different issue that needed to be addressed. Here goes:

Code:
```#include <iostream>
#include <cmath>
using namespace std;

float Quad(float x, float y, float z);

int main() {

float a;
float b;
float c;
float funcvarb;

cout << "\tQuadratic Formula is Fun!! (that's why this is doing it for you) "<< endl;
cout << "\t\tInput the coefficients to the quadratic equation!" << endl;
cout << "(A)X^2 input a please" ;
cin >> a;
cout << "\n(B)X   input b please" ;
cin >> b;
cout << "\n(C)    input c please" ;
cin >> c;

cout << "X = " << funcvarb << endl;
cin.get();
return 0;
}

float Quad(float x, float y, float z) {
plusanswer = ((-y + sqrt((y*y) - 4(x)(z)))/2x)
minusanswer = ((-y - sqrt((y*y) - 4(x)(z)))/2x)
cin.get();
}```
I had the idea of making the Quadratic formula work...but you know how that goes. Also, I want to know if i can let it do imaginary by :
let sqrt(-1) = i

Something of that nature. Whatever. I just had a mere idea of how to implement this. Let me tell you the errors!
Basically the only thing is that it says i can't use 4 and 2 as a function because when i say
Code:
`4(x)(z)`
it assumes it's a function. How do I fix this? Much help is appreciated. I hope I have good structure and everything

2. You're forgetting you are programming when you wrote this. 2x, 2(x)(y).. these things are correct in math, but in programming you need to have operations.

Just replace the part of this line: 4(x)(z)))/2x, with this: (4*x*z)))/(2*x). You also are missing the semicolon on those two lines. You are also returning two values, when only one can be stored, so you're going to have to cout them in the Quad function, or return a struct.

3. Returning a struct or, more simply, a std::pair seems to be the appropriate design choice here. Also, cin.get() really has no logical place in your function (that is, the purpose of the function is not input and output; make the call after your function call if you so desire).

Additionally, if you want to deal with complex numbers as well, look into std::complex.