Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- const unsigned N = 6;
- bool spr(unsigned* tab, unsigned n, unsigned v)
- {
- for(unsigned i = 0; i < n; ++i)
- if(v == tab[i])
- return true;
- return false;
- }
- void wypelnij(unsigned* tab, unsigned rozmiar) // tab - tablica, która ma byæ wype³niona, rozmiar - rozmiar tablicy
- {
- for(unsigned i = 0; i < rozmiar; ++i)
- tab[i] = 1 + rand() % 49;
- }
- void wypisz(unsigned* tab, unsigned rozmiar)
- {
- for(unsigned i = 0; i < rozmiar; ++i)
- cout << tab[i] << '\t';
- cout << endl;
- }
- int main()
- {
- unsigned tab[N];
- srand(static_cast<unsigned>(time(nullptr)));
- wypelnij(tab, N);
- wypisz(tab, N);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement