1.写程序
#include<windows.h>
using namespace std;
int main(){
system("shutdown -p");
return 0;
}
当然,如果想定时关机,可以这么写:
#include<windows.h>
using namespace std;
int main(){
system("shutdown -s -t 运行后距离关机的秒数");
return 0;
}
或者可以这么写:
#include<windows.h>
#include<iostream>
using namespace std;
int main(){
int n;
cout<<"Please enter the number of seconds(10 or 30 or 100):";//选择关机后的秒数,乱输的话默认一百
cin>>n;
switch (n) {
case 10:
system("shutdown -s -t 100");
break;
case 30:
system("shutdown -s -t 100");
break;
default:
system("shutdown -s -t 100");
break;
}
cout<<":)";//这行是用来整蛊的
return 0;
}
2.找图标
(1)找到游戏,选中并右键(这里以燃烧的远征为例)
选择属性;
复制“目标”里的东西(去掉影号 );
找到代码的.exe文件,右键,选择“创建快捷方式”;
右键快捷方式,选择属性,选择“更改图标”;
把刚才“目标”里的东西(去掉影号 )粘贴上去;
(--以及后面的都不用)
点击“应用”;