我是靠谱客的博主 贪玩石头,这篇文章主要介绍C语言实现系统关机注销功能,现在分享给大家,希望可以做个参考。

本文实例为大家分享了C语言实现系统关机注销的具体代码,供大家参考,具体内容如下

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include<stdio.h> //printf #include<stdlib.h> //system #include<string.h> //strcat---exit int print() { int n; printf("*****c语言关机程序*****n"); printf("1:实现十分钟内定时关机n"); printf("2:立即关闭计算机n"); printf("3:注销计算机n"); printf("0:退出系统n"); printf("请输入你要选择的功能0——3:n"); scanf("%d",&n); return n; } void main() { system("title c语言关机程序"); //设定dos窗口名称 system("mode con cols=100 lines=100"); //列column,行lines,将dos窗口转化为100行,100列 system("color 0B"); //0(即前者)幕背景颜色,B(即后者)前背景颜色 system("date /T"); //打印系统当前时间 /T作用不太清楚 system("TIME /T"); //打印系统当前日期 char cmd[20]="shutdown -s -t"; //-s关闭计算机,-t延迟时间, char t[5]="0"; int c = print(); getchar(); switch(c) { case 1: printf("您想在多少秒后自动关闭计算机?(0--600)n"); scanf("%s",t); system(strcat(cmd,t)); //"system -s -t 100"延迟100秒之后关闭计算机 break; case 2: system("shutdown -p"); //仅关闭本地计算机 break; case 3: system("shutdown -l"); //-l:注销当前用户 break; case 0: break; default: printf("errorn"); } system("pause"); //冻结屏幕,便于观察程序的执行结果 exit(0); }

效果:

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持靠谱客。

最后

以上就是贪玩石头最近收集整理的关于C语言实现系统关机注销功能的全部内容,更多相关C语言实现系统关机注销功能内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(139)

评论列表共有 0 条评论

立即
投稿
返回
顶部