谁能用C语言写出一个个程序,让电脑能够自动关机?

谁能用C语言写出一个个程序,让电脑能够自动关机?,第1张

可以的,给以下代码已经编译运行确认了(害得我关了一次机!)

#include<stdio.h>

#include<dos.h>

#include<stdlib.h>

void

main()

{

char

shut[8]

char

b[81]

printf("Hello,

Welcome

to

the

TC

automatic

shutdown

procedures\n")

printf("

Watermelon

production\n")

printf("Please

enter

your

desired

automatic

shutdown

of

time:")

scanf("%s",shut)

sprintf(b,"at

%s

shutdown

-s",shut)

system(b)

}

运行实例:

Hello,

Welcome

to

the

TC

automatic

shutdown

procedures

Watermelon

production

Please

enter

your

desired

automatic

shutdown

of

time:12:29

新加了一项作业,其作业

ID

=

1

1a字符串赋值a[20]={‘0’}

2scanf(“%s”,a)字符串赋值.不用循环

3字符串相等关系运算有特定函数可以实现,当然自己写也可以,不过你的写法有问题,c字符串不支持直接做关系运算

4 getch函数缺少头文件,if else,else选择可缺省 返回关键字使用也有问题

你这个程序我可以帮你写,不过功能是否能实现不确定,因为我也是半瓶水,最后的函数没用过。

最后再补充一点,你头文件引用语法就有错误,没有空格


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/7769364.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-09
下一篇 2023-04-09

发表评论

登录后才能评论

评论列表(0条)

保存