Showing posts with label c program to shutdown PC. Show all posts
Showing posts with label c program to shutdown PC. Show all posts

Sunday, 1 February 2015

Log off computer or terminate all programs with C++ program

Structure of the Problem Requirements 

This Program will log off or terminate all programs with C++ code in PC. There are many commands in C++ system class which directly access the computer and make quick change in the system according to the code in program . In this problem we just used the system-f command which log off the system and terminate all the process .

Source Code

#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
char choice ;
cout<<" \t \t \t LEP Tutorials \n \n "<<endl;
cout<<" Do You Want to ShutDown All the Progrms ? Y/N "<<endl;
cout<<" ";
cin>>choice;
if ((choice =='y' )||(choice =='Y' ))
{
system("shutdown -f");
}
else
{
return 0;
}
}

Output of the Program

Log off computer or terminate all programs with C++ program