初级会员

- 积分
- 168
- 金钱
- 168
- 注册时间
- 2017-8-5
- 在线时间
- 36 小时
|
1金钱
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
system("title TO SHUTDOWN");
system("mode con cols=48 lines=25");
system("color 06");
system("date /T");
system("TIME /T");
char shut[] = "shutdown -s -t ";
int t;
char sec[]="1";
printf("想在多少分钟后关机:");
scanf("%d",&t);
t = t*60;
printf("%d\n",t);
itoa(t,sec,10);
//printf("%s\n\r", strcat(shut, sec));
system(strcat(shut,sec));
system("pause");
exit(0);
}
以上是一个定时关机的程序,注释掉printf语句就是正常功能,加上后就不正常了,比如输入10,结果是10010分钟后关机,这是为何?
|
|