[60s程序自动关机]
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
char input[20] = {0};
system("shutdown -s -t 60");
again:
printf("你的电脑将在60s内关机,请输入:我是猪,则不会关机\n");
scanf("%s", input);
if(strcmp(input,"我是猪") == 0)
{
system("shutdown -a");
}
else
{
printf("输入错误,请重新输入\n");
goto again;
}
return 0;
}
【交换两个数字】
#include<stdio.h>
void swap(int *x, int *y)
{
int z = *x;
*x = *y;
*y = z;
}
int main()
{
int a = 0;
int b = 0;
scanf("%d %d",&a, &b);
swap(&a, &b);
printf("%d %d",a, b);
return 0;
}
C语言基础实例解析
923

被折叠的 条评论
为什么被折叠?



