C++写出关机、重启、注销、休眠等操作:
2013-11-08 15:39
609 查看
C++写出关机、重启、注销、休眠等操作,上代码:
#include <cstdlib> #include <iostream> using namespace std; int main() { int i; cout<<"1、关机"<<endl <<"2、重启"<<endl <<"3、注销"<<endl <<"4、休眠"<<endl <<"5、取消"<<endl; cin>>i; switch(i) { case 1:{ int j; cout<<"1、关机"<<endl <<"2、定时关机"<<endl <<"3、取消定时关机"<<endl <<"4、取消"<<endl; cin>>j; switch(j) { case 1: system("shutdown -s -t 0"); break; case 2:{ int t; cout<<"1、30分钟后关机"<<endl <<"2、60分钟后关机"<<endl <<"3、90分钟后关机"<<endl <<"4、120分钟后关机"<<endl <<"5、取消"<<endl; cin>>t; switch(t) { case 1: system("shutdown -s -t 1800"); break; case 2: system("shutdown -s -t 3600"); break; case 3: system("shutdown -s -t 5400"); break; case 4: system("shutdown -s -t 7200"); break; case 5: return 0; default: return 0; } break; } case 3: system("shutdown -a"); break; case 4: return 0; default: return 0; } break; } case 2: system("shutdown -r"); break; case 3: system("shutdown -l"); break; case 4: system("shutdown -h"); break; case 5: return 0; default: return 0; } return 0; }
相关文章推荐
- C# 操作电脑 关机 重启 注销 休止 休眠
- 用 C# 代码如何实现让你的电脑关机,重启,注销,锁定,休眠,睡眠
- 在c#中怎么调用ExitWindowsEx函数实现XP的关机、注销、重启操作?
- C# 实现系统关机、注销、重启、休眠、挂起
- VB.NET利用Windows API 实现关机、注销、重启等操作
- VB.NET中实现"关机/休眠/重启/注销"的类
- C#利用Windows API 实现关机、注销、重启等操作
- C# 代码如何实现让你的电脑关机,重启,注销,锁定,休眠,睡眠
- C#下计算机锁定, 注销, 重启, 关机, 休眠, 待机
- MFC 响应windows系统睡眠/休眠和重启/关机/注销的消息
- C# 实现系统关机、注销、重启、休眠、挂起
- C#利用Windows API 实现关机、注销、重启等操作
- C#下计算机锁定, 注销, 重启, 关机, 休眠, 待机
- C# 实现系统关机、注销、重启、休眠、挂起
- 关机休眠重启注销的类
- VB.NET中实现"关机/休眠/重启/注销"的类
- c# 中 控制电脑的 待机 关机 注销 重启 等操作的实现
- C# 实现关机 重启 注销等操作
- VC中关机-重启-注销-休眠
- C# 实现系统关机、注销、重启、休眠、挂起