Advertisement
Guest User

7.7

a guest
May 4th, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <fstream>
  4. #include <stdlib.h>
  5. using namespace std;
  6.  
  7. void fillarray(int array[]);
  8.  
  9. int main()
  10. {
  11. srand(time(0));
  12. int count =0;
  13. int array[10];
  14. int i=0;
  15. while(i<10)
  16. {
  17. array[i]=0;
  18. i++;
  19. }
  20. fillarray(array);
  21. cout<<"Number of 0's "<<array[0]<<endl;
  22. cout<<"Number of 1's "<<array[1]<<endl;
  23. cout<<"Number of 2's "<<array[2]<<endl;
  24. cout<<"Number of 3's "<<array[3]<<endl;
  25. cout<<"Number of 4's "<<array[4]<<endl;
  26. cout<<"Number of 5's "<<array[5]<<endl;
  27. cout<<"Number of 6's "<<array[6]<<endl;
  28. cout<<"Number of 7's "<<array[7]<<endl;
  29. cout<<"Number of 8's "<<array[8]<<endl;
  30. cout<<"Number of 9's "<<array[9]<<endl;
  31.  
  32. return 0;
  33. }
  34.  
  35. void fillarray(int array[])
  36. {
  37. int count=0;
  38. while(count<100)
  39. {
  40.  
  41. int add=(0+rand()%10);
  42. array[add]=array[add]+1;
  43. count++;
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement