溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

C語(yǔ)言之批處理定時(shí)關(guān)機(jī)程序

發(fā)布時(shí)間:2020-05-23 12:49:49 來(lái)源:網(wǎng)絡(luò) 閱讀:545 作者:cnBrave 欄目:編程語(yǔ)言

#include <stdio.h>

#include <windows.h>

int main()

{

system("title 定時(shí)關(guān)機(jī)程序V1.0");

system("color 1F");

system("mode con: cols=30 lines=15");

char cmd[20]="shutdown -s -t ";

char t[5]="0",g[10],abc[1]="2";

myTab:

system("cls");

printf("\n");

printf(" 現(xiàn)在系統(tǒng)時(shí)間是:");

system("time /t");

printf("\n 請(qǐng)選擇功能選項(xiàng):\n");

printf("\n 1.定時(shí)關(guān)機(jī);\n");

printf("\n 2.取消關(guān)機(jī);\n");

printf("\n 3.退出程序;\n");

printf("\n ");

scanf("%s",abc);

if(strcmp(abc,"1")==0)

{

goto dingShiShutDown;

}

if(strcmp(abc,"2")==0)

{

goto shutDownA;

}

if(strcmp(abc,"3")==0)

{

exit(0);

}

Sleep(1000);//等待10秒鐘 

goto myTab;//返回菜單項(xiàng),以此來(lái)刷新時(shí)間項(xiàng) 

dingShiShutDown:

printf("\n 請(qǐng)輸入定時(shí)關(guān)機(jī)時(shí)間(秒):\n");

scanf("%s",t);

system(strcat(cmd,t));//執(zhí)行shutdown -s -t 10

goto myTab;

shutDownA:

system("shutdown /a");

 

goto myTab;

//getchar();

}


向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI