#include<stdio.h>
#include<string.h>
#include<stdlib.h>
void main()
{
char cmd[20]="shutdown -s -t ";
char t[5]="0";
int c;
system("shutdown"); //
system("mode con cols=48 lines=25"); //窗口宽度高度
system("color f0"); //red 调出颜色组
system("date /T");
system("TIME /T");
cout<<"----------- C语言关机程序 -----------\n";
cuot<<"1.实现10分钟内的定时关闭计算机\n";
cout<<"2.立即关闭计算机\n";
cout<<"3.注销计算机\n";
cout<<"0.退出系统\n";
cout<<"-------------------------------------\n";
cin>>c;
switch(c) {
case 1:
cout<<"多少秒后自动关闭计算机?\n"<<endl;
cin>>t;
system(strcat(cmd,t));
break;
case 2:
system("shutdown -p");
break;
case 3:
system("shutdown -l");
break;
case 0:
break;
default:
cout<<"Error!\n";
}
system("pause");
return 0;
}
C++ 使用dos的例子
最新推荐文章于 2022-11-06 07:34:19 发布