Facebook
From Johny, 6 Years ago, written in C++.
Embed
Download Paste or View Raw
Hits: 274
  1. #include <iostream>
  2. #include <ctime>
  3. #include <cstdlib>
  4.  
  5. using namespace std;
  6.  
  7. int tab[101];
  8.  
  9. int main()
  10. {
  11.  
  12.         srand(time(NULL));
  13.  
  14.         for (int i = 0; ; i++)
  15.         {
  16.                 int los = (rand() % (99)+1);
  17.                 if (los % 2 == 1)
  18.                 {
  19.                         tab[los] = tab[los] + 1;
  20.                 }
  21.                 int ilosc = 0;
  22.                 for (int a = 1; a < 101; a++)
  23.                 {
  24.                         if (tab[a] == 0)
  25.                         {
  26.                                 ilosc = ilosc + 1;
  27.                         }
  28.                 }
  29.                 if (ilosc == 0)
  30.                 {
  31.                         break;
  32.                 }
  33.         }
  34.         for (int i = 0; i < 101; i++)
  35.         {
  36.                 if (tab[i] == 1)
  37.                 {
  38.                         cout << i << " " << endl;
  39.                 }
  40.         }
  41.        
  42.         system("pause");
  43.         return 0;
  44. }