MichalWalczak

Zad 13 TABLICE

Apr 19th, 2020
483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include <iostream>
  2. #include <time.h>
  3. #include <cstdlib>
  4. using namespace std;
  5.  
  6. int main()
  7. {   int x;
  8.     cout << "Losowanko: Podaj 6 liczb z zakresu od 1-49 aby sprawdzic czy cos ugrales" << endl;
  9.     int los[6];
  10.     int typ[6];
  11.     for(int i=0; i<6; i++){
  12.         cin>>x;
  13.         typ[i]=x;
  14.     }
  15.     srand(time(NULL));
  16.     for(int i=0; i<6; i++){
  17.         los[i]=rand()%49+1;
  18.     }
  19.     for(int i=0; i<6; i++){
  20.         for(int j=0; j<6; j++){
  21.             if(typ[j]==los[i]){
  22.             cout<<"Gratulacje! Trafiles liczbe: "<<los[i];
  23.         }
  24.         }
  25.     }
  26.  
  27.  
  28.  
  29.  
  30.  
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment