#include<iostream> #include<conio.h> #include<stdlib.h> #include<stdio.h> using namespace std; int main() { int ch; cout<<"Select any of the following::"; cout<<"\n1.Shutdown"; cout<<"\n2.Restart"; cout<<"\nEnter your choice here:"; cin>>ch; if (ch==1) { cout<<"\nYour system will shutdown after 30 seconds"; system("c:\\windows\\system32\\shutdown /s /t 30 \n\n"); } else if(ch==2) { cout<<"\nYour system will restart after 30 seconds"; system("c:\\windows\\system32\\shutdown /r /t 30\n\n"); } else { cout<<"\nInvalid Choice"; } cout<<"\n\n@Myprogworld\n\n"; }
Important:-
If you have installed your windows in other drive like D: ,so write D: at the place of c: