#include "stdafx.h" #include #include const double SPLIT = 0.1; const int COUNT = 200; const double PI = 3.14159265; const int INTERVAL = 300; int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { // TODO: Place code here. DWORD busySpan[COUNT]; DWORD idleSpan[COUNT]; int half = INTERVAL / 2; double radian = 0.0; for (int i = 0; i < COUNT; i++) { busySpan[i] = INTERVAL * i / COUNT; idleSpan[i] = INTERVAL - busySpan[i]; } DWORD starttime = 0; int j = 0; while (true) { j = j % COUNT; starttime = GetTickCount(); while (GetTickCount() - starttime <= busySpan[j]); Sleep(idleSpan[j]); j++; } return 0; }