Wednesday, 20 June 2012

how to shut down computer using c++


c++ shutdown computer

This is the source code for shutting down the computer
#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");     //c++ shutdown

   return 0;
}
End

6 comments:

  1. this is not working

    ReplyDelete
  2. will this work with turbo c++ version 3.0

    ReplyDelete
  3. Wow no one has one that actually works, you suck!

    ReplyDelete
    Replies
    1. on what compiler you try this????
      i think its for dev software.
      you have to add some other things according to the compiler.

      Delete