调整控制台大小 mode con cols=40 lines=15

  • 用system()函数调整控制台大小
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <Windows.h>

#define WIDTH 40
#define HEIGHT 15

int main()
{
    char cmd[128] = { 0 };
    sprintf(cmd, "mode con cols=%d lines=%d", WIDTH, HEIGHT);
    system(cmd);

    system("pause");
    return 0;
}

image

posted @ 2022-04-10 11:37  荒年、  阅读(186)  评论(0编辑  收藏  举报