/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <iostream>
#include <random>
using namespace std;
int main()
{
default_random_engine generator;
uniform_real_distribution<float> dist(0.0f,100.0f);
int noofFailed = 0;
const int noofIterations = 100;
for (int i = 0 ; i < noofIterations ; i++)
{
//get 3 random float numbers in the [0,100) range
float a = dist(generator);
float b = dist(generator);
float c = dist(generator);
if ( a*b*c != c*b*a)
{
cout << "Comparison failed: " + to_string(a*b*c) + " != " + to_string(c*b*a) +"\n";
noofFailed++;
}
}
cout << to_string(noofFailed) + " out of "+ to_string(noofIterations) + " sets failed \n";
return 0;
}