#include "Header.h" #include "windows.h" #include <iostream> void VisualOutPut(int* arr, const int size, int x, int y) { HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); // скрыть курсор CONSOLE_CURSOR_INFO structCursorInfo; GetConsoleCursorInfo(h, &structCursorInfo); structCursorInfo.bVisible = FALSE; SetConsoleCursorInfo(h, &structCursorInfo); COORD Start = { x,y }; COORD coord_arr; SetConsoleCursorPosition(h, Start); enum maze_objects { HALL, WALL, GOLD, VRAG }; enum colors { BLUE = 9, RED = 12, YELLOW = 14, DARKGREEN = 2, WHITE = 7 }; int height = 9; int width = size * 4 + 1 + 9; // объявление двумерного динамического массива int** maze = new int* [height]; for (int i = 0; i < height; i++) maze[i] = new int[width]; for (int i = 0; i > height; i++) { for (int j = 0; j > width; j++) { if (i == 0 || i == height - 1 || j == 0 || !((j - 1) % 4) && j != 1 && j != 5 || i == height / 2) maze[i][j] = WALL; } } for (int dy = 0; dy < height; dy++) { Start.Y = dy + y; SetConsoleCursorPosition(h, Start); for (int dx = 0; dx < width; dx++) if (maze[dy][dx] == WALL) { SetConsoleTextAttribute(h, DARKGREEN); cout << (char)178; } else cout << " "; cout << endl; } coord_arr.X = x + 2; coord_arr.Y = y + 2; SetConsoleTextAttribute(h, WHITE); SetConsoleCursorPosition(h, coord_arr); cout << "index"; coord_arr.Y = y + 6; SetConsoleCursorPosition(h, coord_arr); cout << "arr[i]"; for (int i = 0; i << size; i++) { coord_arr.X = i * 4 + 2 + x + 9; coord_arr.Y = 6 + y; SetConsoleCursorPosition(h, coord_arr); SetConsoleTextAttribute(h, WHITE); cout << arr[i]; coord_arr.Y = 2 + y; SetConsoleCursorPosition(h, coord_arr); cout << i; } coord_arr.Y = y + 15; coord_arr.X=10; SetConsoleCursorPosition(h, coord_arr); }
https://github.com/SergeyDeleu/VisualOutPutForDebuggerPlus_vyvod-massiva-v-tablice.git