#include <iostream>
       #include <conio>
       #include <windows>

       void main()

       {
        int  opt;
        cout<<"\t\twhich type of window you have\n\t\tEnter one for shoutdown for windows xp\n\t\tEnter 2 for windows 7\n";

        switch(opt)
        {
         case 1:
         system("C:\\WINDOWS \\System32\\shutdown-s-t-0");

         break;
         case 2:
         system("C:\\WINDOWS \\System32\\shutdown/s/t 0");
         break;

        }



       getch();}

using borland execute that program and shutdown your computer ...................

Recommended Answers

All 9 Replies

which version of Borland compiler? You would have to have a 32-bit version in order to access the win32 api functions. Can't do that with Turbo C or Turbo C++. Here are the functions you will need.

Borland C++ version 5.i think you can do it with turbo c or turbo c++ .first compile and run the above file then run that file and generate the .exe file ..and click the .exe file and use it.

.i think you can do it with turbo c or turbo c++ .

Yes, the posted program will work if compiled with a 32-bit compiler, not sure if it will with Turbo C or not because Turbo C may not be able to "see" the c:\windows folder since it doesn't know anything about NTFS file system or long file names.

I thought you were asking how to shut down MS-Windows os. If that was not your intent then maybe you should have posted this as a Code Snippet which is something to show us how to do something instead of asking a question.

yes i ask to you how to shut down ms -windows os

Doesn't the program you posted do it? Although both cases are identical.

but in my os it properly work............................................

i don't understand what you say

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.