Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include<stdlib.h>
  2. #include<iostream>
  3. #include<time.h>
  4. #define SIZE 250
  5. using namespace std;
  6. int main() {
  7. const double ratings[] = { 2,3,3.5,4,4.5,5,5.5};
  8. int results[SIZE], stat[7] = {}, i;
  9. srand (time(NULL));
  10. for (i = 0; i < SIZE; i++)
  11. results[i] = rand() % 7; // drawing rating index
  12. for (i = 0; i < SIZE; i++)
  13. stat[results[i]]++;
  14. for (i = 0; i < 7; i++)
  15. cout << ratings[i] << "-" << stat[i] << endl;
  16. return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement