SHARE
TWEET

Untitled

a guest Oct 21st, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top