Use C to write a heater

Source: Internet
Author: User

When winter is over, the leaves fall, And the geese fly south in a B-or T-shaped manner, the programmers are still playing the keyboard in the cold computer. As a good programmer, we can use a program to solve all the problems except our wives. What's more, it's a little cold wind. Next we will use C to write a heater.
Theoretically, computers consume electricity. In addition to the luminous voice, this part of electricity is used for fever. Simply put, the CPU, hard disk, and even memory are all hot due to work. Taking into account the versatility of the program, we do not consider the video card sound card drive, we use memory read and write to make the memory fever, use a lot of computing to make the CPU fever, use file read and write to heat the hard disk, finally, we can make the computer a small heater.
The code that heats up the CPU is as follows:

DWORD winapi cpuhotter (pvoid para)
{
While (1 );
Return 1;
}

The code that heats up the memory is as follows:

DWORD winapi memhotter (pvoid para)
{
Char * mem = new char [10000];
While (1)
{
For (INT I = 0; I <10000; I ++)
{
Mem [I] = 0x99;
}
}
Return 1;
}

Finally, the code that heats up the hard disk:

DWORD winapi diskhotter (pvoid para)
{
File * FP;
Fp = fopen ("_", "A + ");
While (1)
{
For (INT I = 0; I <10000; I ++)
{
Fwrite ("1", 1, 1, FP );
}
Rewind (FP );
}
Return 1;
}

The main function can be used to create the above three threads. This code is compiled and run successfully in the athlon 1.26 + 256 m + VC 6.0 environment. Windows 2000 runs for three days and the indoor temperature continues to rise. It is proposed to apply for a national patent. Inspired by open-source ideas, the source code is released, hoping to bring you a warm winter.
Thank you.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.