抱歉,问题可能有些愚蠢,但是否有一种方法可以在屏幕上的随机位置绘制一个字符,而不使用任何“沉重”的图形库?
谢谢, 李
谢谢, 李
HDC hdc = GetDC(NULL);
RECT rc;
rc.left = 0;
rc.right = 100;
rc.top = 0;
rc.bottom = 100;
DrawText(hdc, L"Bla", 3, &rc, 0);
#include "windows.h"
void gotoxy(int x, int y)
{
COORD coord;
coord.X = x; coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_H ANDLE), coord);
}
void PaintcharOnRandomLocation(const char c)
{
srand(0);
int x = rand(79);
int y = rand(24);
gotoxy(x,y);
putch(c);
}