Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- const int n = 11;
- void printarray (int arr[n][n]); //Выводим массив на печать
- void randomize (int arr[n][n]); //Заполняем рандомными числами массив-лабиринт
- int main() {
- srand(static_cast<unsigned int>(time(nullptr)));
- int arr[n][n] = {0};
- randomize(arr);
- return 0;
- }
- void randomize (int arr[n][n]) { //Заполняем рандомными числами массив-лабиринт
- cout << "Генерация лабиринта " << n << " на" << n << ":" << endl;
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < n; j++) {
- arr[i][j] = rand() % 2;
- }
- }
- }
- void printarray (int arr[n][n]) { //Выводим массив на печать
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < n; j++) {
- cout << arr[i][j] << " ";
- }
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement