Wednesday, 29 May 2013

how to shut down your computer using c++




This is very interesting program.when you compile and run this program it will ask you that "do you want to shut down your computer?".so this is an interesting application of c++.


#include <stdio.h>
#include <stdlib.h>

main()
{
   char ch;

   printf("Do you want to shutdown your computer now (y/n)\n");
   scanf("%c",&ch);

   if (ch == 'y' || ch == 'Y')
      system("C:\\WINDOWS\\System32\\shutdown -s");

   return 0;
}
End

2 comments: