Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include<ctime>
  3. #include<cstdlib>
  4.  
  5.  
  6. using namespace std;
  7.  
  8. int main(){
  9.     int tab[100];
  10.     int i;
  11.     int a[16]= {0,0,0,0,0,0,0,0,0,0,0,0,0};
  12.     srand(time(NULL));
  13.    
  14.     for(i=0;i<100;i++)
  15.     {
  16.         tab[i] = rand() % 15+1;
  17.         if(tab[i] > 16)
  18.             cout << "error code 1, i : " <<tab[i]<< endl;
  19.    
  20.         a[tab[i]]++;
  21.     }
  22.     for(i=0;i<16;i++){
  23.         cout << i+1 << " powtarza si\251:" << a[i]<<endl;  
  24.     }
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement