Here we will see how to shut down the system by writing simple C or C code. The shutdown process varies between operating systems. If we are Linux users, we can use this terminal command to shut down.
shutdown –P now
If we are using Windows system, we can use this command -
c:\windows\system32\shutdown /i
We will see the code for Linux and Windows
#include<iostream> using namespace std; int main() { system("shutdown -P now"); }
#include<iostream> using namespace std; int main() { system("c:\windows\system32\shutdown /i "); }
The above is the detailed content of C/C++ program that shuts down the system?. For more information, please follow other related articles on the PHP Chinese website!