世人都晓c#好,唯有奇葩忘不了。
让我们看看,c++中有哪些特殊的(奇葩)语句。
1.关机代码(不用我多说了吧)(不要轻易去尝试!):
#include<windows.h>
using namespace std;
int main(){
system("Shutdown /s /t 0");
return 0;
}
后面的“0”是时间,单位毫秒,0的话是立即关机。
2.解关机代码(对应):
#include<windows.h>
using namespace std;
int main(){
system("Shutdown /a");
return 0;
}
3.B——(beep):
#include<windows.h>
using namespace std;
int main(){
beep(1200,10000);
return 0;
}
这个程序能发出声音~~~详情请见文章:计时器(倒计时)(二)。
4.start:
#include<windows.h>
using namespace std;
int main(){
system("start https://www.bilibili.com/"); //打开B站
return 0;
}
#include<windows.h>
using namespace std;
int main(){
system("start cmd"); //打开管理员
return 0;
}
5.color:
#include<windows.h>
using namespace std;
int main(){
system("color 16"); //将程序背景调成深蓝色(有点鸡肋)
return 0;
}
不定时更新