Dumitru Eduard Dumitru Eduard - 1 year ago 56
C++ Question

How can I see the full 20x70 2d array that I just created? C++

New here. Okay so in my project I have a 20x70 2d array, but I can't see it all using the usual 2d array printing. By "see it all" I mean my console is too small. Is there any way of printing the full matrix and see it? Or is there any library that could help me printing it like in a canvas?
Edit: I'm using Codeblocks as my IDE and working in a Windows Console. I've searched on google for some time and I didn't find an answer to this question. I found only answers to how to print a 10x10 2d array.

Answer Source

You can try to resize the console window as described here:

#include <iostream>

//the following line is necessary for the
//  GetConsoleWindow() function to work!
//it basically says that you are running this
//  program on Windows 2000 or higher
#define _WIN32_WINNT 0x0500

//it is important that the above line be typed
//  BEFORE <windows.h> is included
#include <windows.h>

using namespace std;

int main (void)
  HWND console = GetConsoleWindow();
  RECT r;
  GetWindowRect(console, &r); //stores the console's current dimensions

  //MoveWindow(window_handle, x, y, width, height, redraw_window);
  MoveWindow(console, r.left, r.top, 800, 600, TRUE);
  for (int j = 0; j < 100; ++j)
      for (int i = 0x41; i < 0x5B; ++i)
        cout << (char)i;
  cout << endl;
  MoveWindow(console, r.left, r.top, r.right - r.left, r.bottom - r.top,        TRUE);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download