We only need to use system to call the system command to realize the shutdown operation
refer to:lautturi.com/*
Example:shutdown system in C language
*/
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char const *argv[]) {
system("shutdown -s -t 0"); // Windows
system("shutdown now"); // Unix/Linux
}