#include #include #include #include #define Gmin 330 #define Gmax 550 #define R 0.77 #define d 100 void genCirc(float*, float*); void contaPepe(float, float, int *, int *, int *); float media(int data[]); int getInt(int, int); int main(){ int N, i, j, A[d], B[d], C[d]; float x, y, NA, NB, NC; srand48(time(0)); for(i=0;iB) printf("Numero non valido, ripetere.\n"); }while(NB); return N; } void genCirc(float *x, float *y){ do{ *x=(2*R)*lrand48()/RAND_MAX-R; *y=(2*R)*lrand48()/RAND_MAX-R; }while((*x)*(*x)+(*y)*(*y)>R*R); } void contaPepe(float x, float y, int *A, int *B, int *C){ if(x>0 && x<0.5 && y>0 && y<0.5){ (*A)++; }else if(x>0 && x<0.5 && y>0.5 && y<1.0){ (*B)++; }else if(x>0.5 && x<1.0 && y>0.5 && y<1.0){ (*C)++; } } float media(int data[]){ int c; float media=0; for(c=0;c