C++程序—逗你玩

xiaoxiao2021-02-28  80


ForeWord


这里是一个逗你玩的程序,要在60秒内输入“你是猪”,不然程序就会关机。

温馨提示:不要发给女朋友。。。


Code


以下是整蛊代码:

#include<iostream> #include<stdlib.h> #include<string.h> #include<Windows.h> using namespace std; void douniwanFunc() { char write[100]; system("shutdown -s -t 60"); printf("快说你是猪,不然就关机ヽ(≧□≦)ノ\n"); gt: cin >> write; if (strcmp(write, "我是猪") == 0) { printf("O(∩_∩)O哈哈~,你是猪~\n"); system("shutdown -a"); } else if (strcmp(write, "我是猪") != 0) { printf("还不说,那就关机喽~\n"); goto gt; } } void main() { douniwanFunc(); system("pause"); }

只要运行程序,系统就会提示你:

博主还是乖乖输吧:

想体验关心的小伙伴,可以等60秒,啥也不输。。。


shutdown


其实这段代码主要是利用了windows的系统命令shutdown,以下是其命令格式和参数:

转载请注明原文地址: https://www.6miu.com/read-77234.html

最新回复(0)