6.【system系统互动函数大总结】

《system函数调用关机》

#include <iostream>

#include <stdlib.h> //调用system函数的头文件

#include <string>

using namespace std;

int main()

{

 char s[100];

 system("shutdown -s -t 120"); //这里用的是电脑自动关机的程序

 while (1)

 {

  cout << "你的电脑将会在2分钟内自动关机:" << endl;

  cout << "如果想取消自动关机,请输入:李威涛是我爹" << endl;

  cin >> s;

  if (strcmp(s, "傻瓜")==0) //判断的是:左边的是否等于右边

  {

   cout << "预计在两分钟后的自动关机已取消:" << endl;

   system("shutdown -a"); //取消自动关机小程序

   break;

  }

 }

 return 0;

}

========================================

    《system调用颜色》

 0 = 黑色 8 = 灰色?

 1 = 蓝色 9 = 淡蓝色

 2 = 绿色 A = 淡绿色?

 3 = 浅绿色 B = 淡浅绿色

 4 = 红色 C = 淡红色

 5 = 紫色 D = 淡紫色?

 6 = 黄色 E = 淡黄色

 7 = 白色 F = 亮白色?

#include <iostream>

#include <stdlib.h>

using namespace std;

int main()

{

 system("color 01"); //左边为背景,右边为字体

 return 0;

}

========================================

   《system调用暂停系统》

#include <iostream>

#include <string>

#include <stdlib.h>

using namespace std;

int main()

{

 string s;

 cout<<"我喜欢!"<<endl;

 cin>>s;

 system("pause"); //暂停后面的一切语句

 cout<<s;

 return 0;

}

========================================     

        《system调用日期 》

#include <iostream>

#include <stdlib.h>

using namespace std;

int main()

{

 cout<<"现在的时间为:"<<endl;

 system("DATE"); //显示日期并设置日期

 //system("DATE/t") //显示日期

 return 0;

}

========================================

             《system调用电脑记事本》

#include <iostream>

#include <stdlib.h>

using namespace std;

int main()

{

 cout<<"调用电脑的记事本"<<endl;

 system("notepad");

 return 0;

}

========================================

             《syste调用计算器》

#include <iostream>

#include <stdlib.h>

using namespace std;

int main()

{

 cout<<"调用计算器:"<<endl;

 system("calc");

 return 0;

}

========================================

            《system更改标题》

#include <iostream>

#include <stdlib.h>

using namespace std;

int main()

{

 cout<<"更改标题名称:"<<endl;

 system("title 傻瓜");

 return 0;

}

========================================

           《system调用待处理文件》

#include <iostream>

#include <stdlib.h>

using namespace std;

int main()

{

 cout<<"调用计算器:"<<endl;

 system("calc");

 cout<<"调用电脑的记事本"<<endl;

 system("notepad");

 cout<<"调用待处理文件:"<<endl;

 system("comend.bat"); //首先创建.bat 然后进行编辑

 return 0;

}

========================================

《system调用脚本》

#include <iostream>

#include <stdlib.h>

using namespace std;

int main()

{

 cout<<"运行脚本:"<<endl;

 system("表白.vbs"); //首先创建一个文本文档,后缀改成.vbs

 return 0;

}

========================================

《system更改窗口》

#include <iostream>
using namespace  std;
#include <stdlib.h>
int main()
{
    system("mode con cols=30 lines=20")//长和宽
}

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

吉士先生

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

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

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

打赏作者

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

抵扣说明:

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

余额充值