Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <time.h>
  3. #include <cstdlib>
  4. using namespace std;
  5.  
  6. int main() {
  7. srand(time(0));
  8. int liczba[15], wyst[5];
  9. for (int i=0; i<5;i++) wyst[i]=0;
  10. for (int i=0; i<15;i++){
  11. liczba[i] = rand()%(2+2+1)-2;
  12. cout<<liczba[i]<<endl;
  13. wyst[liczba[i]+2]++;
  14.  
  15. }
  16. for(int i=0;i<=2+2;i++){
  17. cout<<"liczba "<<i-2<<" wystapila "<<wyst[i]<<" razy\n";
  18. }
  19.  
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement