Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- #include <cstdlib>
- using namespace std;
- const int r = 3;
- struct kwadrat
- {
- int tab[r][r];
- };
- //losuj
- //wypisz
- //wczytaj
- //czymagiczny
- void wypisz(const kwadrat&);
- void losuj(const kwadrat&);
- int main()
- {
- srand(time(0));
- kwadrat k;
- wypisz(k);
- losuj(k);
- return 0;
- }
- void losuj(const kwadrat& kwa)
- {
- for(int i = 0; i < r; i++)
- {
- for(int j = 0; j < r; j++)
- {
- kwa.tab[i][j] = rand()%10;
- }
- }
- }
- void wypisz(const kwadrat& k)
- {
- for(int i = 0; i < r; i++)
- {
- for(int j = 0; j < r; j++)
- {
- cout << k.tab[i][j] << "\t";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement