I am working on the same question as another member posted here, but I am going about it slightly differently as I see the equation differently.. I can get my program to compile and run, but I run into an issue after I enter in my unsigned int seed. It says that i have not declared "component reliability" even tho I clearly have. What do I seem to be missing here?
Also, under this area: " if (((num1<=component_reliability) &&
((num2<=component_reliability)) &&
(num3<=component_reliability)))", I was considering changing the component reliability to a_parallel considering that is the answer to the equation. I worked out this equation by hand, and it gives me the correct analytical reliability, I just cant seem to get the program to execute it..
Firstly, please edit your post so it uses code tags - the <> button on the right
You have declared component_reliability, but have not assigned a value to it.
The other thing to be careful about is comparing doubles the way you do. Floating point numbers (floats & doubles etc.) are stored as binary fractions and cannot represent every real number. This why they shouldn't be compared directly. Consider this:
1 2 3 4 5
float a = 0.1; // a == 0.09999997
float b = 10.0 * a; // b == 0.9999997
if(a == b) //false
Changing the type to double doesn't help.
You can make use of std::numeric_limits<double>epsilon it needs to be scaled up to the numbers you are using.
Google floating point epsilon to see how to do it correctly.