当前位置:网站首页>[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 .
边栏推荐
- Sprint for golden nine and silver ten, stay up at night for half a month, collect 1600 real interview questions from Android post of major manufacturers
- [C language] print pattern summary
- 2022年下半年系统集成项目管理工程师认证8月20日开班
- Digital filter design matlab
- Labelme(一)
- 认识中小型局域网WLAN
- Use Hal Library of STM32 to drive 1.54 inch TFT screen (240*240 st7789v)
- 时间转日期的sql语句应该怎么写?
- KubeEdge发布云原生边缘计算威胁模型及安全防护技术白皮书
- The results of the second quarter online moving people selection of "China Internet · moving 2022" were announced
猜你喜欢

【微信小程序开发】页面导航与传参

Thoroughly understand bit operations - shift left, shift right

CDGA|工业互联网行业怎么做好数据治理?

High beam software has obtained Alibaba cloud product ecological integration certification, and is working with Alibaba cloud to build new cooperation

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

XOR operation and its usage

Basic concept and essence of Architecture
![[C language] initial C language reflection and summary](/img/21/826d144867f7a73ec2cd8896a5250a.png)
[C language] initial C language reflection and summary

Prometheus deployment
![[C language] print pattern summary](/img/48/d8ff17453e810fcd9269f56eda4d47.png)
[C language] print pattern summary
随机推荐
Token verification program index.php when configuring wechat official account server
数字滤波器设计——Matlab
Labelme (I)
认识中小型局域网WLAN
Implementation of memmove in C language
This customized keyboard turns me on~
Getting started with enterprise distributed crawler framework
Cell review: single cell methods in human microbiome research
时间转日期的sql语句应该怎么写?
What is the process of swing event processing?
C language operators and input and output
Thoroughly understand bit operations -- and (&), not (~), or (|), XOR (^)
Use of strtok and strError
MIR专题征稿 | 常识知识与推理:表示、获取与应用 (10月31日截稿)
Application skills of programming rising and falling edge instructions of botu 1200/1500plc (bool array)
【微信小程序开发】页面导航与传参
Cdga | how can the industrial Internet industry do a good job in data governance?
[C language] scanf format input and modifier summary
Failed to install app-debug. apk: Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]
English Translation Spanish - batch English Translation Spanish tools free of charge