This is what i have so far guys,

//LAB 6

#include <iostream>
#include <cmath>

using namespace std;



double getSides ()
{
    double sideA, sideB, sideC;
    cout << "Enter three sides: " << endl;
    cin >> sideA >> sideB >> sideC;

}

bool formTriTest (double sideA, double sideB, double sideC)
{
    if (sideA + sideB > sideC
        || sideB+ sideC > sideA
        || sideA + sideC > sideB)
    {
        return false;
    }
}

double perimeter (double sideA, double sideB, double sideC)
{
    double pAns;

    pAns = sideA + sideB + sideC;

    return pAns;
}

double triArea (double sideA, double sideB, double sideC, double S)
{
    S = (sideA + sideB + sideC) / 2.0;

    double area;

    area = sqrt (S* (S - sideA )*(S - sideB) *(S - sideC));

    return area;
}


int main()
{
    cout << getSides();
}

The program in its final goal state, must consist of at least three functions:

(a) One function to test if a, b, c can actually form a triangle, and the function’s return type is “bool”
(b) One function to find the perimeter of a triangle.
(c) One function to find the area of a triangle.

Limitations :
I read in a few sets of triangles until the program comes across a set that consists a zero in any of the values, then the program stops.

I wont ask anyone to write my program I realize that.

What I require for now is help on passing the values of the sideA sideB and sideC inputs into the other functions for calculation. How do I accomplish this?

edited.

//LAB 6

#include <iostream>
#include <cmath>

using namespace std;



bool formTriTest (double a, double b, double c)
{
    if (a + b > c
        || b+ c > a
        || a + c > b)

        return true;
    else
        return false;
}

double perimeter (double A, double B, double C)
{
    double pAns;

    pAns = A + B + C;

    return pAns;
}

double triArea (double sideA, double sideB, double sideC, double S)
{

    double area;

    area = sqrt (S* (S - sideA )*(S - sideB) *(S - sideC));

    return area;
}

double semiP (double a, double b, double c)
{
    double s;

    s = (a + b + c) / 2.0;

    return s;
}

int main()
{
    double sideA, sideB, sideC, peri, semiPerimeter, triangleArea, testTri;


    do
    {
    cout << "Enter three sides: " << endl;
    cin >> sideA >> sideB >> sideC;

    testTri = formTriTest(sideA, sideB, sideC);


        semiPerimeter = semiP(sideA, sideB, sideC);

    triangleArea = triArea(sideA, sideB, sideC, semiPerimeter);
    cout << "Triangle (" << sideA << ", " << sideB << ", " << sideC << ")"
    << " ==> ";
    cout << "Area " << "(" << triangleArea << "), ";

    peri = perimeter(sideA, sideB, sideC);

    cout << "Perimeter " << "(" << peri << ");" << endl;
    } while ((testTri = true));



}

OUTPUT EXAMPLE:
Enter three sides:
3 4 5
Triangle (3, 4, 5) ==> Area (6), Perimeter (12);
Enter three sides:
1 2 3
Triangle (1, 2, 3) ==> Area (0), Perimeter (6);
Enter three sides:

The issue here is it shouldnt pass the triangle test when I enter 1, 2, 3 as my values.
What am I doing wrong here?

Welcome to the world of dealing with floating point numbers. My suspiscion is that 1 + 2 as a double is giving you something like 3.0000000000001 which will be greater than 3. If you have a debugger where you can step through your code I would do that to see what the values are.

Nathan, I'm using xCode to compile here, Im not sure where to look for debugger output.

bool formTriTest (double a, double b, double c)
{
    if ((a + b) > (c+1)
        || (b+ c) > (a+1)
        || (a + c) > (b+1))

        return 1;
    else
        return 0;
}

I tried this since you said the floating no.s' decimal may be the issue but its still not returning false. Is there another way I could re-write this function?

Sorry my mistake. You should be using && not || in your if statement. The three numbers will form a triangle only if all three inequalities are true. If any of them are false then they will not make a triangle.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.