壁花小姐奇遇记1,周卫星何晶晶小品,森永健司
c语言实现定时关机的代码教程
#include<stdio.h> #include<string.h> #include<stdlib.h> int main() { char cmd[20] = "shutdown -s -t "; char times[10] = "0"; int min = 0; int choose; system("title timing shutdown program"); //设置cmd窗口标题 system("mode con cols=50 lines=35"); //窗口宽度高度 system("color f0"); //可以写成 red 调出颜色组 system("date /t"); system("time /t"); printf("\nwhat do you want me to do ...\n"); printf("\n1.timing shutdown\t"); printf("2.shutdown\n"); printf("3.logout\t"); printf("\t4.shutdown cancel\n"); printf("0.exit\n\n"); printf("-> "); while (~scanf("%d", &choose)) { switch (choose) { case 1: printf("set a timer to count down...(minutes) \n");//输入分钟 printf("-> "); scanf("%d", &min); min = min * 60; sprintf(times, "%d", min); system(strcat(cmd, times)); printf("hey,you can input 4 to cancel shutdown progress whenever you want...\n"); break; case 2: system("shutdown -p"); break; case 3: system("shutdown -l"); break; case 4: system("shutdown -a"); break; case 0: exit(0); break; default: printf("-> please input right number!\n"); } } return 0; }
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
如何在没有core文件的情况下用dmesg+addr2line定位段错误
用QT制作3D点云显示器——QtDataVisualization
网友评论