跳到正文

个人记录

关机代码

peng201203约 1 分钟
原文
文章信息与版本

文章信息

发布
2024年11月14日
收录
2025年12月12日
更新
2026年11月17日
篇幅
约 1 分钟

版本

  1. v1当前
C++
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;

int main(){
	cout<<"关机程序\n"; 
	if(MessageBox(NULL,"是否运行?","它将关掉你的电脑!",MB_YESNO|MB_ICONEXCLAMATION)==IDYES){
		system("shutdowm -s -t 30");
		cout<<"30秒后关机!"; 
	}
	else{
		cout<<"运行失败......"; 
	}
	return 0;
}
原文