Quadratic equation

My teacher wants me write c++ statements that computes the value of (-b + (b^2-4ac)1/2 )/2a and assigns the result to y. Here a, b, c, and y are variables of type float. Assume there is a function sqrt that computes power 0.5 so that sqrt(16) evaluate to 4.

I have no idea where or how to start. Please help!
It's pretty easy to start:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include<iostream>
#include<cmath>

using namespace std;

float quad_equation(float, float, float);//Have you covered functions yet?

int main()
{
    //blagh blagh blagh
    return 0;
}

float quad_equation(float a, float b, float c)
{
    //blagh blagh blagh
}

Work from there and post whatever you have so far.
Last edited on
Topic archived. No new replies allowed.