Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <time.h>
- using namespace std;
- int tab[20];
- int main()
- {
- srand(time(0));
- for(int i=1;i<=20;i++)
- {
- tab[i]=rand()%21;
- cout << tab[i] << " ";
- }
- cout << endl << "odgadnij cyfre od 0 do 20: ";
- int a;
- int b=0;
- cin >> a;
- for (int j=1;j<=20;j++)
- {
- if (a==tab[j])
- {
- b=b+1;
- }
- }
- if (b>=1) cout << "jest taka cyfra";
- if (b<1) cout << "nie ma takiej cyfry";
- getchar();
- cin.ignore();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement