64,648
社区成员
发帖
与我相关
我的任务
分享
#include <windows.h>
#pragma comment( linker, "/subsystem:windows /entry:mainCRTStartup" )
int main()
{
int width = GetSystemMetrics(SM_CXSCREEN);
int height = GetSystemMetrics(SM_CYSCREEN);
SetActiveWindow(0);
HDC hdc=::GetDC(0);
int i=0;
while(i<100)
{
int x=rand()%(width-30);
int y=rand()%(height-30);
Rectangle(hdc,x, y, x+30,y+30);
Sleep(1000);
}
}