// -- A small process used to simulate the detection of Kingsoft drug overlord and other software virusesProgram
// -- Refer to jiurl's friend Program
// -- 04/28/2006 Friday
// -- Computer lab
// -- Micro_lee
# Include <stdio. h>
# Include <windows. h>
# Include <stdlib. h>
# Include <conio. h>
# Include <time. h>
Void main ()
{
Handle Hout;
Hout = getstdhandle (std_output_handle );
Setconsoletextattribute (Hout, foreground_green); // set the color.
Int I = 0;
Int interval = 5000;
Srand (unsigned) Time (null ));
While (1 ){
Setconsoletextattribute (Hout, foreground_green );
If (RAND () % 10 = 0) setconsoletextattribute (Hout, foreground_intensity | foreground_green );
If (RAND () % 2) printf (""); // print at a time: half may be blank
Else printf ("% d", Rand () % 2); // print at a time: 1/4 may be 1, 1/4 may be 0.
For (I = 0; I <rand (); I ++)
{
_ ASM NOP
}
// Use for to control the time without sleep (),
// The reason is that sleep () does not work when the interval is very small.
// Of course, when sleep () is used, the for loop like sleep () is very expensive for CPU resources.
If (kbhit () break; // click to exit
}
Return;
}
// -- Download the source code and use VC to build the project of the Win32 console application for compilation.