Showing posts with label c program for pc restart. Show all posts
Showing posts with label c program for pc restart. Show all posts

Sunday, 1 February 2015

Restart PC with C++ Program

Structure of the Problem Requirements

With this program a user can restart computer with C++ program . System class is used to restart the computer and we just pass the parameter 'system-r' to system class and this piece of code restart the computer .

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 Restart PC ? Y/N "<<endl;
cout<<" ";
cin>>choice;
if ((choice =='y' )||(choice =='Y' ))
{
system("shutdown -r");
}
else
{
return 0;
}
}

Output of the Program

Restart PC with C++ Program