C++中的system()

1.暂停pause

用处:等待用户按下任意键后继续执行。

#include <bits/stdc++.h> 
using namespace std;

int main()
{
	cout<<"猴子爱吃RPG"<<endl;
	system("pause");
	cout<<"最帅!!!"; 
	return 0;
}

 运行结果:

2.调整颜色color

用处:调整控制器的背景颜色和字体颜色。

具体颜色对应表格:

例:

#include <bits/stdc++.h> 
using namespace std;

int main()
{
	system("color 3F");//3表示背景为淡绿色,F表示字体为亮白色 
	cout<<"猴子爱吃RPG最帅!!!"; 
	return 0;
}

运行结果:

3.清屏cls

用处:清除执行器上的所有文字。

例:

#include <bits/stdc++.h> 
using namespace std;

int main()
{
	cout<<"猴子爱吃RPG……"<<endl; 
	system("pause");
	system("cls");
	cout<<"最衰!!!";
	return 0;
}

运行结果:

……

4.日期与时间date/t,time/t

用处:输出当前日期或时间

例:

#include <bits/stdc++.h> 
using namespace std;

int main()
{
	system("time/t");
	system("date/t");
	return 0;
}

运行结果:

(电脑显示)

(执行器显示)

5.设置control(独门秘籍)

用处:用C++召唤出控制面板

#include <bits/stdc++.h> 
using namespace std;

int main()
{
	system("control");
	return 0;
}

运行结果:

 6.关机shutdown

用处:让电脑重启/关机/睡眠……

例:………………(无法提供实例)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值