JakubJaneczek

Zadanie 13

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