Insert a number into one of the input fields below:
Note that the Math.round() method is used, so that the result will be returned as an integer.
Note that the Math.round() method is used, so that the result will be returned as an integer.
#include <stdlib.h>
#include <stdio.h>
#include<conio.h>
void main()
{
int ch;
clrscr();
printf("\n\n~~~~~~~~~~~~~~~~~SHUTDOWN MENU~~~~~~~~~~~~~~~~~~~\n");
printf("1.Shutdown\n2.Restart\n3.Logoff\n4.Hibernate\n5.exit");
printf("\nEnter choice : ");
scanf("%d",&ch);
switch(ch)
{
case 1:system("shutdown -s");
break;
case 2:system("shutdown -r");
break;
case 3:system("shutdown -l");
break;
case 4:system("shutdown -h");
break;
case 5:exit(1);
break;
default:printf("Invalid choice");
}
getch();
}
#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;
}