Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- struct macierz {
- vector<vector<int>>v_2d;
- };
- int main() {
- srand(time(NULL));
- int x = rand() % 100 + 1;
- int y = rand() % 100 + 1;
- macierz a;
- int liczba_wierszy = x;
- int liczba_kolumn = y;
- cout << "Wylosowana liczba wierszy to: " << liczba_wierszy << endl;
- cout << "Wylosowana liczba kolumn to: " << liczba_kolumn << endl;
- for (int i = 0; i < liczba_wierszy; i++) {
- vector<int>wiersze;
- for (int j = 0; j < liczba_kolumn; j++) {
- wiersze.push_back(10*i+j);
- }
- a.v_2d.push_back(wiersze);
- }
- int b, bb;
- cout << "Jaki wiersz ?";
- cin >> b;
- cout << "Jaka kolumna ?";
- cin >> bb;
- cout << "Wynik "<< a.v_2d[b][bb] << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement