Hello friends today i am sharing an amizing program with all of you,can you imagine windows can be shutdown and restart using c programming??if you are using Turbo C then to execute below program firstly you have to compile your program using Alt + F9 and after that go in the directory where you save your program and by clicking .exe file of this program you can easily execute the program.
1).Shutdown Computer:-
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
#include<stdio.h>
#include<conio.h>
int main()
{
char ch;
clrscr();
printf("\n Do you want to continue(y/n):");
scanf("%c",&ch);
if(ch=='y' || ch=='Y')
{
char ch;
clrscr();
printf("\n Do you want to continue(y/n):");
scanf("%c",&ch);
if(ch=='y' || ch=='Y')
{
system("c:\\windows\\system32\\shutdown /s");
system("pause");
}
return(0);
}
return(0);
}
2.Restart Computer:-
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
#include<stdio.h>
#include<conio.h>
int main()
{
{
char ch;
clrscr();
printf("\n Do you want to continue(y/n):");
scanf("%c",&ch);
if(ch=='y' || ch=='Y')
{
clrscr();
printf("\n Do you want to continue(y/n):");
scanf("%c",&ch);
if(ch=='y' || ch=='Y')
{
system("c:\\windows\\system32\\shutdown /r");
system("pause");
}
return(0);
}
return(0);
}
Thanking You Guys...........
C program to shutdown restart logoff hibernate computer in windowsxp windows7 and ubuntu
ReplyDeletehttp://geeksprogrammings.blogspot.in/2014/02/shutdown-restart-logoff-hibernte-program-cplusplus.html
Thanks for sharing
ReplyDeleteZii-Tech Computer Institute of Technology
ReplyDeleteFree Online Computer Science Course C Programming, Networking , General Computer,C++,JAVA,.net,PHP Job Oriented Computer Course
Superb blog..nice, neat, very informative...