猫史档案馆


C++指令控制台

用户:RendexORERendexORE查看:1 回复:1 评论:1 创建时间:2024-07-06T12:02:19


Lunix版本:

#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main()
{
    string command,value;
    bool cls;
    while(true)
    {
		if(cls==false)
		{
			cout<<">>>";
		}
		cin>>command>>value;
		if(cls==true)
		{
			system("clear");
		}
		if(command=="out")
		{
			cout<<value<<endl;
		}
		if(command=="@out")
		{
			if(value=="off")
			{
				cls=true;
			}
			else
			{
				if(value=="on")
				{
					cls=false;
				}
				else
				{
					cout<<"Error:Not exist value"<<endl;
				}
			}
		}
		if(command=="clean"&&value=="\\")
		{
			system("clear");
		}
		if(command=="sys")
		{
			system(value.c_str());
		}
		if(command=="apt-install")
		{
			system(("sudo apt install "喵alue).c_str());
		}
		if(command=="apt-remove")
		{
			system(("sudo apt remove "喵alue).c_str());
		}
		if(command=="downloads")
		{
			system(("wget "喵alue).c_str());
		}
		if(command=="rsl"&&value=="\\")
		{
			cout<<"rsl v1.1.2\nCopyright Rinson Tec 2024\n";
		}
	}
}

Windows版本:

#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main()
{
    string command,value;
    bool cls;
    while(true)
    {
		if(cls==false)
		{
			cout<<">>>";
		}
		cin>>command>>value;
		if(cls==true)
		{
			system("cls");
		}
		if(command=="out")
		{
			cout<<value<<endl;
		}
		if(command=="@out")
		{
			if(value=="off")
			{
				cls=true;
			}
			else
			{
				if(value=="on")
				{
					cls=false;
				}
				else
				{
					cout<<"Error:Not exist value"<<endl;
				}
			}
		}
		if(command=="clean"&&value=="\\")
		{
			system("cls");
		}
		if(command=="sys")
		{
			system(value.c_str());
		}
		if(command=="downloads")
		{
			system(("wget "喵alue).c_str());
		}
		if(command=="rsl"&&value=="\\")
		{
			cout<<"rsl v1.1.2\nCopyright Rinson Tec 2024\n";
		}
	}
}

RSL 1.1.2


回复

上一页1 页 / 共 1下一页
RendexORERendexORE

输入out yyy则输出yyy,输入@out on/off可开/关命令输出,输入downloads yyy可下载yyy,输入sys可执行系统控制台命令,输入clean清屏

 

点赞0


评论