如何查看刚刚创建的完整 20x70 二维数组? C++
How can I see the full 20x70 2d array that I just created? C++
这里是新的。好吧,在我的项目中,我有一个 20x70 二维数组,但我无法使用通常的二维数组打印来看到它。 "see it all" 我的意思是我的控制台太小了。有没有办法打印完整的矩阵并在控制台中看到它?或者是否有任何图书馆可以帮助我像 canvas 一样打印它?
编辑:我使用 Codeblocks 作为我的 IDE 并在 Windows 控制台中工作。我在 google 上搜索了一段时间,但没有找到这个问题的答案。我只找到了如何打印 10x10 二维数组的答案。
您可以按照here:
所述尝试调整控制台大小window
#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;
Sleep(1000);
MoveWindow(console, r.left, r.top, r.right - r.left, r.bottom - r.top, TRUE);
}
这里是新的。好吧,在我的项目中,我有一个 20x70 二维数组,但我无法使用通常的二维数组打印来看到它。 "see it all" 我的意思是我的控制台太小了。有没有办法打印完整的矩阵并在控制台中看到它?或者是否有任何图书馆可以帮助我像 canvas 一样打印它? 编辑:我使用 Codeblocks 作为我的 IDE 并在 Windows 控制台中工作。我在 google 上搜索了一段时间,但没有找到这个问题的答案。我只找到了如何打印 10x10 二维数组的答案。
您可以按照here:
所述尝试调整控制台大小window#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;
Sleep(1000);
MoveWindow(console, r.left, r.top, r.right - r.left, r.bottom - r.top, TRUE);
}