70,017
社区成员




#pragma comment(lib,"user32")
#pragma comment(lib,"gdi32")
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <windows.h>
extern "C" HWND WINAPI GetConsoleWindow();
void HideTheCursor() {
CONSOLE_CURSOR_INFO cciCursor;
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
if(GetConsoleCursorInfo(hStdOut, &cciCursor)) {
cciCursor.bVisible = FALSE;
SetConsoleCursorInfo(hStdOut, &cciCursor);
}
}
void ShowTheCursor() {
CONSOLE_CURSOR_INFO cciCursor;
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
if(GetConsoleCursorInfo(hStdOut, &cciCursor)) {
cciCursor.bVisible = TRUE;
SetConsoleCursorInfo(hStdOut, &cciCursor);
}
}
int main() {
HWND hwnd;
HDC hdc;
int x[6],y[6];
int i;
for (i=0;i<6;i++) {
x[i]=150+(int)(100.0*cos(i*60.0/180.0*3.1416));
y[i]=150+(int)(100.0*sin(i*60.0/180.0*3.1416));
}
system("color F0");
system("cls");
HideTheCursor();
hwnd = GetConsoleWindow();
hdc = GetDC(hwnd);
MoveToEx(hdc,x[0],y[0],NULL);
LineTo(hdc,x[1],y[1]);
LineTo(hdc,x[2],y[2]);
LineTo(hdc,x[3],y[3]);
LineTo(hdc,x[4],y[4]);
LineTo(hdc,x[5],y[5]);
LineTo(hdc,x[0],y[0]);
ReleaseDC(hwnd,hdc);
getchar();
system("color 07");
system("cls");
ShowTheCursor();
return 0;
}