C++控制台界面库_屏幕类

屏幕类可以设置窗口标题,大小,显示或隐藏光标,光标位置,文本颜色等。

示例代码:

// ConsoleApplication1.cpp : 此文件包含 “main” 函数。程序执行将在此处开始并结束。
//

#include “console.h”
#pragma comment(lib,“console.lib”)

int main()
{
Screen screen;
screen.ShowOrHideCursor(0);
screen.SetTitle(“示例1”);
screen.SetSize(80, 25);
screen.Paint_screen(14);

screen.TextAttribute(6, 10);
screen.DisplayText(30, 5,"这是一个示例。");

screen.SetTextColorAndTextBackgroundColor(4,7);
screen.MoveCursorTo(30,10);
screen.Write("hello world!");

screen.SetTextColorAndTextBackgroundColor(2,14);
screen.MoveCursorTo(30, 15);
screen.Pause();

return 0;

}

运行效果:

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/aier_wl/article/details/107297803