#include<iostream>
using namespace std;
int main()
{  for(int i=0;;i++)
{
system("cls");
char ch;
void restar();//重启函数声明
void logout();//注销函数声明
void close();//关机函数声明
void offtime();//定时关机函数声明
void exit();
cout<<"\n\n\n"; 
cout<<"                        阿 的 多 小 助 手           "<<endl<<endl<<endl;
cout<<"              ************** 1.重启 **************"<<endl<<endl;
cout<<"              ************** 2.注销 **************"<<endl<<endl;
cout<<"              ************** 3.关机 **************"<<endl<<endl;
cout<<"              ************** 4.定时关机 **********"<<endl<<endl;
cout<<"              ************** 5.退出 **************"<<endl<<endl;
cout<<"              ***  作者:偶遇    qq:1398195383  ***"<<endl<<endl;
cout<<"              请选择:";
    ch=getchar();
switch(ch)
{
case '1':restar();break;
case '2':logout();break;
case '3':close();break;
    case '4':offtime();break;
    case '5':exit();break;

}
}
void restar()//重启函数
{
cout<<endl<<endl;
cout<<"              你确定要重启吗?{是(Y或者y)否(N或者n)}:";
char ch1;
cin>>ch1;
if(ch1=='y'||ch1=='Y')
{
cout<<"\n\n              正在重启......."<<endl<<endl;
 system( "shutdown -r -t 0" );
}
else if(ch1=='n'||ch1=='N')
{
cout<<"\n\n              慎重考虑后,不重启!\n"<<endl<<endl;
    }
}

void logout()//注销函数
   {
    cout<<endl<<endl;
cout<<"              你确定要注销吗?{是(Y或者y)否(N或者n)}:";
char ch2;
cin>>ch2;
if(ch2=='y'||ch2=='Y')
{
cout<<"\n\n              正在注销......."<<endl<<endl;
  system( "shutdown -l" );
}
else if(ch2=='n'||ch2=='N')
{
cout<<"\n\n              慎重考虑后,不注销!\n"<<endl<<endl;
    }
   }

void close()//关机函数
    {
cout<<endl<<endl;
cout<<"              你确定要关机吗?{是(Y或者y)否(N或者n)}:";
char ch3;
cin>>ch3;
if(ch3=='y'||ch3=='Y')
{
cout<<"\n\n              正在关机中......."<<endl<<endl;
system( "shutdown -p" );
}
else if(ch3=='n'||ch3=='N')
{
cout<<"\n\n              慎重考虑后,不关机!\n"<<endl<<endl;
    }
}
void offtime()//定时关机函数
{
   char ch4;
                   cout<<"\n\t              请选择要关机的时间!"<<endl;
                   cout<<"\n\t                  1.10分钟        \n\t";
                   cout<<"\n\t                  2.30分钟        \n\t";
                   cout<<"\n\t                  3.60分钟        \n\t";
                   cout<<"\n\t                  4.120分钟       \n\t";
                   cout<<"\n\t                  5.150分钟       \n\t";
  cout<<"\n\t                  6.退出          \n\t";
  cout<<"\n\t 请选择:";
   cin>>ch4;
   switch(ch4)
   {
                  
     case '1':cout<<"\n\t   你的机子将在10分钟后关闭!";
  system("shutdown -s -t 600");break;
     case '2':cout<<"\n\t   你的机子将在30分钟后关闭!";
  system("shutdown -s -t 1800");break;
     case '3':cout<<"\n\t   你的机子将在1小时后关闭!";
   system("shutdown -s -t 3600");break;
     case '4':cout<<"\n\t   你的机子将在2小时后关闭!";
       system("shutdown -s -t 7200");break;
     case '5':cout<<"\n\t   你的机子将在2个半后后关闭!";
   system("shutdown -s -t 9000");break;
     case '6':exit(6);break;
         
   }

}
void exit()
{
cout<<endl<<endl;
cout<<"              你确定要退出吗?{是(Y或者y)否(N或者n)}:";
char ch5;
cin>>ch5;
if(ch5=='y'||ch5=='Y')
{
cout<<"\n\n              已退出......."<<endl<<endl;
}
else if(ch5=='n'||ch5=='N')
{
cout<<"\n\n              慎重考虑后,不退出!\n"<<endl<<endl;
    }
}