Shutdown & Restart Computer in C++
![Dev C++ Codes For Hacking Dev C++ Codes For Hacking](/uploads/1/2/6/8/126881934/411655746.png)
To shutdown and restart you computer using C++ programming, just call the functionsystem() of stdlib.h library which will call the cmd or terminal.
So to shutdown and restart your computer, just place your code (including full path) to shutdown and restart your computer.
Here, we provided three programs to shutdown and restart your computer. The first program is to shutdown your computer system. The second program is to restart your computer and the third program is for both shutdown and restart your computer (this program is menu-driven).
$ begingroup $ @Poik Sorry for marking it in C I was just going by this post link where the top answer states 'if a person writes the code in a C style and compiles it with C then it is a C question'. However I do see the OOP would make the code a lot easier to read and thank you for the tip:). $ endgroup $ – Funky Oct 13 '14 at 21:24.
![Dev C++ Codes For Hacking Dev C++ Codes For Hacking](https://ae01.alicdn.com/kf/Hc52b60126c824b9489f9a89d424cfc57O/Computer-Stickers-Laptop-Stikcers-for-Developer-100Pcs-Programming-Stickers-for-Developers-Coders-Programmers-Hackers-Geeks.jpg_q50.jpg)
Shutdown Your Computer in C++
Following C++ program shutdown your computer system after 20 seconds.
C++ Programming Code to Shutdown Computer
Dev C++ Download
After compiling and running the above C++ program, your computer will be shutdown after 20 seconds.
Restart Your Computer in C++
Following C++ program restart your computer system after 10 seconds. That is, after 10 seconds, your computer will be shutdown and then restart.
C++ Programming Source Code to Restart Computer
After compiling and running the above C++ program, your computer will restart after 10 seconds.
Shutdown then Restart Your Computer in C++
Following c++ program made for both i.e., to shutdown your computer or to restart your computer (shutdown or turn off then turn on), first it will ask to the user that either he/she want to shutdown computer or want to restart computer. Option 1 is given for shutdown computer and option 2 is given for restart computer. When the option is entered, then widows system file will be executed which is placed inside the function system() of stdlib.h that letting the system to either shutdown computer or restart your computer. The delay to shutdown computer or restart computer is 20 second. This time is taken by the system to shutdown computer or restart computer. But you can change this time like you can make time 0 to shutdown computer or restart computer immediately or you can increase the time to make shutdown computer or restart computer after the given time.
Dev C++ Hacking
Here if you will choose 1st option, then your system will be shutdown after 20 seconds, and if you will choose 2nd option, then your system will be restarted after 20 seconds (it first shutdown after 20 seconds, then start )
Same Program in Other Language
Dev C++ Codes For Hacking Facebook
You may like the same program in other programming languages: