目次
実行可能ファイルのリソース リンクについては、ブログのリソース リストを参照してください。
殴られたことを責めないでください
#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. system() 関数は <windows.h> ヘッダー ファイルに存在し、命令を括弧内に入力できます。この関数の実行は、cmd コマンド パッドにこのコマンドを直接入力するのと同じです。
2.shutdown -s -t 60: このコマンドは、t = 60 秒以内にコンピューターをシャットダウンすることを意味します。時刻は自分で変更できます。
3.shutdown -a: このコマンドは、直前のシャットダウン操作を取り消すことができます。
4. strcmp() 関数は <string.h> ヘッダー ファイルに存在します。