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

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 user 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

Share on Google Plus

About Asad

Asad Niazi is Software Engineer , Programmer, Web Developer and a young mentor of BloggersTown and PProgramming. Asad Love to writes about Technology, Programming, Blogging and make money online.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment