当前位置:网站首页>[C language] shutdown game [loop and switch statement]
[C language] shutdown game [loop and switch statement]
2022-07-28 20:04:00 【An ran_】
List of articles
One 、 Code implementation
One, two, three ! Code up !
//goto Small application of statement
// Shutdown games
// Implementation method 1:goto sentence
#include <stdio.h>
int main()
{
char input[10] = {
0 };
system("shutdown -s -t 60");
again:
printf(" The computer will be in 1 Shut down in minutes , If input : I am a pig , Just cancel the shutdown !\n Please enter :>");
scanf("%s", input);
if (0 == strcmp(input, " I am a pig "))
{
system("shutdown -a");
}
else
{
goto again;
}
return 0;
}
// Implementation method 2: loop
#include <stdio.h>
#include <stdlib.h>
int main()
{
char input[10] = {
0 };
system("shutdown -s -t 60");
while (1)
{
printf(" The computer will be in 1 Shut down in minutes , If input : I am a pig , Just cancel the shutdown !\n Please enter :>");
scanf("%s", input);
if (0 == strcmp(input, " I am a pig "))
{
system("shutdown -a");
break;
}
}
return 0;
}
notes : Call up before compiling and running cmd Command window , Otherwise, it will not have the desired effect . in addition , The countdown time can be flexibly controlled by yourself , The unit is seconds
Two 、 Add
1.shutdown Instructions
Windows The system comes with a name Shutdown.exe The program , Can be used for shutdown operations ( Position in Windows[System32](https://baike.baidu.com/item/System32/7268040) Next ), In general Windows The shutdown of the system can be done by calling the program shutdown.exe To achieve , The program can also be used to terminate planned shutdown operations .
Relevant operation instructions
shutdown -a Cancel shutdown
shutdown -s To turn it off
shutdown -f Forcibly close the application
shutdown -m \ Computer name Control remote computer
shutdown -i Show “ Remote shutdown ” Graphical user interface , But it has to be Shutdown The first parameter of
shutdown -l Logout the current user
shutdown -r Shut down and restart
shutdown -s -t Time Set shutdown countdown
shutdown -r -t Time Set restart countdown
shutdown -h Sleep
2.cmd Instructions
cmd Microsoft's Windows The command line program of the system , Is a link to the command prompt window . adopt cmd The command enters the command prompt window , Will be displayed Windows Version and copyright information . By using cmd Commands can easily access other sub applications .
边栏推荐
- [NPP installation plug-in]
- Cloud computing notes part.1 - system management
- Crawl IP
- 并发程序设计,你真的懂吗?
- Leetcode Day1 score ranking
- Array method added in ES6
- How many types of rain do you know?
- MySQL performance testing tool sysbench learning
- MySQL8 Status Variables: Internal Temporary Tables and Files
- Source insight project import and use tutorial
猜你喜欢

Edge detection and connection of image segmentation realized by MATLAB

Stories of Party members | Li qingai uses cartoons to drive farmers to increase income and become rich

Intermediate soft test (system integration project management engineer) high frequency test site

2022年下半年系统集成项目管理工程师认证8月20日开班

KubeEdge发布云原生边缘计算威胁模型及安全防护技术白皮书
![[C language] simulation implementation of strlen (recursive and non recursive)](/img/73/e92fe714515491f1ea366d6924c9ec.png)
[C language] simulation implementation of strlen (recursive and non recursive)

adb remount of the / superblock failed: Permission denied

Basic knowledge of communication network 01

冲刺金九银十丨熬夜半个月汇集大厂Android岗1600道面试真题
![[C language] summary of methods for solving the greatest common divisor](/img/38/3a099948ebf51fd0da3076f71f9dad.png)
[C language] summary of methods for solving the greatest common divisor
随机推荐
11. Learn MySQL union operator
C language functions and pointers
【经验之谈】关于维修电子设备的几点建议和经验
Question bank and answers of the latest national fire-fighting facility operators (intermediate fire-fighting facility operators) in 2022
editor.md中markdown编辑器的实现
[in depth study of 4g/5g/6g topics -44]: urllc-15 - in depth interpretation of 3GPP urllc related protocols, specifications and technical principles -9-low delay technology -3-non slot scheduling mini
MySQL8 tmp_ table_ Size and Max_ heap_ table_ size
“中国网事·感动2022”二季度网络感动人物评选结果揭晓
A chip company fell in round B
How does app automated testing achieve H5 testing
Kubeedge releases white paper on cloud native edge computing threat model and security protection technology
[network] cross area network communication learning classification and calculation of IPv4 address
C language operators and input and output
CDGA|工业互联网行业怎么做好数据治理?
[C language] header file of complex number four operations and complex number operations
河北邯郸:拓展基层就业空间 助力高校毕业生就业
Saltstack advanced
Deploy LNMP automatically with saltstack
JS preventdefault() keyboard input limit onmousewheel stoppropagation stop event propagation
MySQL8 Status Variables: Internal Temporary Tables and Files