Social Icons

Pages

C program Code to shutdown,restart,logoff,hibernate the computer

  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include<conio.h>
  4. void main()
  5. {
  6. int ch;
  7. clrscr();
  8. printf("\n\n~~~~~~~~~~~~~~~~~SHUTDOWN MENU~~~~~~~~~~~~~~~~~~~\n");
  9. printf("1.Shutdown\n2.Restart\n3.Logoff\n4.Hibernate\n5.exit");
  10. printf("\nEnter choice : ");
  11. scanf("%d",&ch);
  12. switch(ch)
  13. {
  14. case 1:system("shutdown -s");
  15. break;
  16. case 2:system("shutdown -r");
  17. break;
  18. case 3:system("shutdown -l");
  19. break;
  20. case 4:system("shutdown -h");
  21. break;
  22. case 5:exit(1);
  23. break;
  24. default:printf("Invalid choice");
  25. }
  26. getch();
  27. }

No comments:

Post a Comment