Tricky routine code "I'm a big fool" C language (just 20 lines to make your friend shut down)

Table of contents

 See my blog resource list for executable file resource links


 

 Don't blame me for being beaten

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>

int main(int argc, char const *argv[])
{
    char tembuf[128] = {"0"};
    char buf[128] = {"我是大傻逼"};
    system("shutdown -s -t 60");
    printf("你哥哥来惩罚你!\n");
    printf("\33[31m电脑60s内关机,输入“\33[33m%s\33[31m”,就不关咧!\n麻利麻利\33[0m\n",buf);
    gets(tembuf);
    while (0 != strcmp(tembuf,buf) )
    {
        printf("你就别听话,重新输!!!\n");
        gets(tembuf);
    }
    printf("\33[35m谢谢合作!\33[33m5s自动退出!!!\33[30m\n");
    system("shutdown -a");
    Sleep(5000);
    
    return 0;
}

1. The system() function exists in the <windows.h> header file, and instructions can be typed in brackets. Executing this function is equivalent to directly typing this command in the cmd command pad.
2.shutdown -s -t 60: This command means to shut down the computer within t = 60s. You can modify the time yourself.
3.shutdown -a: This command can undo the shutdown operation just now.
4. The strcmp() function exists in the <string.h> header file.

 

 

 See my blog resource list for executable file resource links

Guess you like

Origin blog.csdn.net/m0_58193842/article/details/128540325