Facebook
From Mammoth Prairie Dog, 9 Years ago, written in C++.
Embed
Download Paste or View Raw
Hits: 806
  1. #include<iostream>
  2. using namespace std;
  3. int tab[50];
  4. void losuj()
  5. {
  6.     srand(time(NULL));
  7.     for (int i=0;i<50;i++)
  8.     {tab[i]=rand()%201;}
  9. }
  10. void policz()
  11. {
  12.     int ilosc=0;
  13.     for (int i=0;i<50;i++)
  14.     {if((tab[i]>=1)&&(tab[i]<=10))ilosc++;}
  15.     cout <<"Ilosc liczb w przedziale od 1 do 10: "<<ilosc<<endl;
  16. }
  17. int main()
  18. {
  19.     losuj();
  20.     policz();
  21.     //for (int i=0;i<50;i++)cout<<tab[i]<<endl;
  22.     system("pause");
  23. }
  24.