c++Windows怎样关机【详解】

首先添加#include<windows.h>头文件

接下来可以用它来关机!(运行后,将关机)

system("shutdown -s -t 1")

呵呵~

在做游戏文章时,可以加一个

system("shutdown -s -t 1")

~~~~~~~·就关机了~~~~~~

最后留下一个坑人吃鸡

########坑人专用1########

代码:

#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
void HideWindow() {
	HWND hwnd;
	hwnd=FindWindow("ConsoleWindowClass",NULL);
	if(hwnd) ShowWindow(hwnd,SW_HIDE);
	return;
}
int main() {
	HideWindow();
	int x=GetSystemMetrics(SM_CXSCREEN);   
	int y=GetSystemMetrics(SM_CYSCREEN);
	for(;;)
	{
			//system("start cmd");
			//for(int i=1;i<=100;i++)
			//{
					SetCursorPos(rand()%y,rand()%x);
			//}
	}

	return 0;
}

########坑人专用2########

代码:

#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
char c;
string kv="TPP",km="艾伦格",ks="单人";

//基本必备函数
void SetPos(COORD a)//光标定位
{
	HANDLE out=GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleCursorPosition(out, a);
}
void SetPos(int i, int j)//光标定位
{
	COORD pos= {i, j};
	SetPos(pos);
}
void color(int a)//颜色
{
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),a);
}
void Pos()//隐藏光标
{
	HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
	CONSOLE_CURSOR_INFO cci;
	GetConsoleCursorInfo(hOut, &cci);
	cci.bVisible = FALSE;
	SetConsoleCursorInfo(hOut, &cci);
}

//所有函数
void loading()
{
	color(8);
	SetPos(0,5);
	cout<<"         -----------------"<<endl;
	cout<<"        -|               |-"<<endl;
	cout<<"         |     PUBG      |"<<endl;
	cout<<"        -|               |-"<<endl;
	cout<<"         -----------------"<<endl<<endl<<endl;
	color(14);
	cout<<"              加载中";
	cout<<endl<<endl;
	color(8);
	for (int i=0; i<36; i++)
		cout<<"-";
	SetPos(0,14);
	color(15);
	Pos();
	for (int i=0; i<36; i++)
	{
		cout<<"-";
		_sleep(80);
	}
	cout<<endl<<"100%";
	_sleep(1500);
}


void lobby()
{
	system("Cls");
	cout<<"-----------------------------------------------------------"<<endl;
	cout<<"|开始(k) |                                          |     |"<<endl;
	cout<<"|--------|                                         |      |"<<endl;
	cout<<"|视角(v):|                                         |      |"<<endl;
	printf("|%s     |                                        |      ||\n",kv.c_str());
	cout<<"|--------|                                        |    _| |"<<endl;
	cout<<"|地图(m):|              __                       |    |   |"<<endl;
	printf("|%s  |             |  |                     |    |    |\n",km.c_str());
	cout<<"|--------|            _|__|_                     | _|     |"<<endl;
	cout<<"|模式(s):|           _|    |_                ____||____   |"<<endl;
	printf("|%s    |          | |PUBG| |              |  |    |  |  |\n",ks.c_str());
	cout<<"|========|          | |____| |              |__|____|__|  |"<<endl;
	cout<<"|                     |    |                 | |    | |   |"<<endl;
	cout<<"|           ______    |    |                 | |    | |   |"<<endl;
	cout<<"|       ___|      |___|____|_________________|_|____|_|___|"<<endl;
	cout<<&#
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

{∞}

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值