Click here to Skip to main content
15,887,361 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
reply fast i want to submit my project
Posted
Comments
[no name] 11-Jun-14 23:24pm    
See this.

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!
 
Share this answer
 
First read solution 1 and then try.. :)

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;
}


C program to shutdown or turn off computer[^]

C program to shutdown PC[^]

C program to shutdown or turn off computer[^]

C Program For Shutdown And Restart Computer In Windows 7[^]

auto-generated closing tags for stdio deleted
 
Share this answer
 
v3
Comments
Ashish Tyagi 40 11-Jun-14 4:00am    
"First read solution 1 and then try.." actually your approach is better :-) my 5.
Nirav Prabtani 11-Jun-14 5:09am    
Thanks ashish.. :)
To simplest way is possibly using system[^] call to issue the shutdown command appropriate for your operative system.
for instance
C
system("shutdown -h now");

on Linux
(Please note: you must have the appropriate privileges, in order to successfully issue the command).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900