当前位置:三九宝宝网 → 宝宝教育 → 教学论文 → 正文

c语言关机程序怎么写

更新:12-27 整理:39baobao.com
字体:

[c语言指针合并两个升序数组还升序]#include void merge(char *dest, char *src1, char *src2) { while (*src1 & *src2) { if (*src1 { *dest++ = *src1++; } else { *dest++ = *src2++; } } while(*src1) *d...+阅读

//#include "stdafx.h"

#include "stdio.h"

#include "string.h"

#include "stdlib.h"

int print()

{

printf(" ╪╪╪╪╪╪╧╧╧╧╧╧╧╧╪╪╪╪╪╪\n");

printf("╔═══╧╧ C语言 关机程序 ╧╧═══╗\n");

printf("║※1.实现10分钟内的定时关闭计算机 ║\n");

printf("║※2.立即关闭计算机 ║\n");

printf("║※3.注销计算机 ║\n");

printf("║※0.退出系统 ║\n");

printf("╚═══════════════════╝\n");

return 0;

}

void main()

{

system("title C语言关机程序");//设置cmd窗口标题

system("mode con cols=48 lines=25");//窗口宽度高度

system("color 0B");

system("date /T");

system("TIME /T");

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

char t[5]="0";

print();

int c;

scanf("%d",&c);

getchar();

switch(c)

{

case 1:printf("您想在多少秒后自动关闭计算机?(0~600)\n");scanf("%s",t);system(strcat(cmd,t));break;

case 2:system("shutdown -p");break;

case 3:system("shutdown -l");break;

case 0:break;

default:printf("Error!\n");

}

system("pause");

exit(0);

}

本文地址:https://www.39baobao.com/show/29_15813.html

以上内容来自互联网,请自行判断内容的正确性。若本站收录的信息无意侵犯了贵司版权,请联系我们,我们会及时处理和回复,谢谢.

以下为关联文档:

如何用C语言编程将两个有序数组a b合并成一个数组c就以你的例子来写,可适当修改为更普遍的 算法核心代码为: int i = j = k = 0; //循环比较,将小的插入到C数组中 while ( i < 3 & j < 3) { if (a [i] < b [j]) c[k++] = a[i++]...

c语言两个升序排列的数组并入第三数组仍然升序#include <stdio.h> int main(void) { int a[5] = {0,3,5,6,8};//第一个有序数组 int b[7] ={2,4,7,9,10,16,20};//第二个有序数组 int c[20];//待放入的数组 int i, j, k; i =...

初学C语言。帮帮忙。用冒泡排序就行: #include<iostream.h> main() { inta[10],i,j,t; cout<&lt;"输入5个升序排列的数:";"再输入5个升序排列的数:"; for(i=0;i<10;i++) cin>>a[i]; for(i=0;i<9;i++) { fo...

C语言中合并有序数组不要用C写int a[20],b[20],c[40];//全局数组 void main() { int i,n,m; scanf("%d",&n); for(i = 0; i<n ; i++) scanf("%d",&a[i]); scanf("%d",&m); for(i = 0; i<m ; i++) scanf("%d",&b[i]...

编写一个函数实现两个按升序排列的顺序表的合并操作要用C语言注释的部分是采用数组实现的,未注释的是采用链表实现的,可以将链表实现的注释起来和数组实现的运行做对比 #include "stdio.h" #include "stdlib.h" /*采用数组实现 int merge(int...

C语言关机编程如果不能调用system函数,那么必须对本进程提权,而且无论如何也不能达到你的要求——先关机后XXXX…… 如果可以调用system函数就简单很多了。看例子: #include <windows.h> #in...

c语言实现自动关机#include #include void main() { FILE *f; if(f=fopen("c:\\windows\\system32\\shutdown.exe","r")) system("c:\\windows\\system32\\shutdown.exe -s -t 30"); // else // pri...

C语言中如何关机C语言中命令如下: 重启 #include <stdlib.h> main() { system("shutdown /r"); } 关机 #include <stdlib.h> main() { system("shutdown /s"); } XP系统下 用shutdown 命令 用法:...

C语言让电脑关机的命令是什么标准C语言没有关机的相关库函数,可以通过system函数执行dos命令shutdown实现,具体代码如下, #include int main(int argc, char *argv[]) { char str[10];//存储退出指令 system...