Advertisement
AbdRoufBUET

Untitled

Aug 11th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #include<iostream>
  5.  
  6. using namespace std;
  7.  
  8. int main ()
  9. {
  10.   int iSecret, iGuess;
  11.  
  12.   /* initialize random seed: */
  13.   srand(time(NULL));
  14.  
  15.   int arr[10000];
  16.  
  17.     double averge = 0;
  18.  
  19.   for(int i = 0; i < 100; i++)
  20.   {
  21.       int temp = rand();
  22.       averge+=temp/(32767*1.0);
  23.      cout<<i+1<<"-> "<<temp/(32767*1.0)<<endl;
  24.  
  25.  
  26.   }
  27.  
  28.   cout<<"Average : "<<averge/100<<endl;
  29.  
  30.   return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement