I'm working on a project, and can't seem to get the project to get the triangle variable to increase when the conditions are met. I need this number to be accurate so I can work out the probability. Below you'll find the project, and my amateurish code. Any help is appreciated.




Problem
Experiments that are either too expensive or too dangerous to perform are often simulated on a computer when the computer is able to provide a good representation of the experiment. Find out how to call the random-number generator (usually a function returning a floating point value in the range 0 to 1) for your C++ system. (Look up the functions rand and srand in the library cstdlib on the website cplusplus.com). Write a program that uses the random-number generator to simulate the dropping of glass rods that break into three pieces. The purpose of the experiment is to estimate the probability that the lengths of the three pieces are such that they might form the sides of a triangle.
For the purposes of this experiment, you may assume that the glass rod always breaks into three pieces. If you use the line segment 0 to 1 (on the real number line) as a mathematical model of the glass rod, a random-number generator (function) can be used to generate two numbers between 0 and 1 representing the coordinates of the breaks. The triangle inequality (the sum of the lengths of two sides of a triangle are always greater than the length of the third side) may be used to test the length of each piece against the lengths of the other two pieces.
To estimate the probability that the pieces of the rod form a triangle, you’ll need to repeat the experiment many times and count the number of times a triangle can be formed from the pieces. The probability estimate is the number of successes divided by the total number of rods dropped. Your program should prompt the user for the number of rods to drop and allow the experiment to be repeated. Use a sentinel value of 21 to hale execution of the program.


Code:
Code:
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cfloat>
#include <iomanip>
#include <stdlib.h>
#include <time.h>


using namespace std;


float doBreak (float, float);
float doProbability (float, float);


const int SENTINEL = 21;        //sentinal value


int main()
{
    float break1;
    float break2;
    float side1;
    float side2;
    float side3;
    float count;
    float tests;
    float triangle;
    float probability;


    const int SENTINEL = 21;
    count = 1;
    srand (time (NULL));


    cout << "Enter number of glassrods to demolish (Enter 21 to end program): ";
    cin >> tests;


    if 
    (tests != SENTINEL)
    {
        do
        {
            doBreak(break1, break2);
            count++;
        }while (count <= tests);


    doProbability(triangle, tests);
    cout << "The probability that the broken glass rods will form a triangle is: " << probability << "%" << endl;
    }
    else
    {
            cout << "Aww, I was hoping to break stuff..." << endl;
    }
    return 0;
}


float doBreak
    (float break1, 
    float break2)
{
    float side1;
    float side2;
    float side3;
    float triangle;
    triangle = 0;
        
    break1 = (float)rand()/RAND_MAX;
    break2 = (float)rand()/RAND_MAX;
    
    if (break1 < break2)
    {
        side1 = break1;
        side2 = (break2 - break1);
        side3 = 1 - break2;
    }
    else if (break2 < break1)
    {    
        side1 = break2;
        side2 = (break1 - break2);
        side3 = 1 - break1;
    }
    else
    {
        side1 = break1;
        side2 = break1;
        side3 = break1;
    }
    if
    ((side1 + side2) > side3 &&
    (side1 + side3) > side2 &&
    (side2 + side3) > side1)
    {
        triangle += 1;
        cout << triangle << endl;
    }
    return side1;
    return side2;
    return side3;
    return triangle;
}
    
float doProbability 
    (float triangle,
    float tests)
{
    float probability;


    probability = (triangle / tests) * 100;
    return probability;
}