#include using namespace std; int main() { int trials{100'000}; int hits = 0; double x , y; for(int i = 0; i < trials; ++i) { x = rand() / static_cast(RAND_MAX); y = rand() / static_cast(RAND_MAX); if (x*x + y*y <= 1) { ++hits; } } cout << 4 * hits / static_cast (trials) << endl; return 0; }