KarolWozniak

Zadanie 13 tablice

Apr 16th, 2020
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int a=1,b=49,c=0;
  10. int lotto[6];
  11. int liczby[6];
  12.  
  13.     srand(time(NULL));
  14.     for(int i=0;i<6;i++)
  15.     {
  16.      lotto[i]=a+rand()%(b-a+1);
  17.     }
  18.  
  19.     cout << " Podaj swoje typy liczb \n";
  20.     for(int i=0;i<6;i++)
  21.     {
  22.         cout << i+1 << " Liczba: ";
  23.         cin >> liczby[i];
  24.     }
  25.     for(int i=0;i<6;i++)
  26.     {
  27.         for(int j=0;j<6;j++)
  28.         {
  29.             if(liczby[i]==lotto[j])
  30.             {
  31.                 c=c+1;
  32.             }
  33.         }
  34.     }
  35.  
  36.     cout << "Gratulacje, odgadles " << c << " liczb";
  37.  
  38.  
  39.     return 0;
  40. }
Add Comment
Please, Sign In to add comment