以下是使用C++写的一个高仿CMD,支持自己添加指令:
code
#include<bits/stdc++.h>
using namespace std;
int main(){
cout<<"Microsoft Windows [版本 10.0.19045.5737]\n(c) Microsoft Corporation。 保留所有权利。\n"<<endl;
while(1){
char c[114514];
cout<<"Arcaea:>";
cin.getline(c,100000);
if(c[0]=='T' && c[1]=='r' && c[2]=='a' && c[3]=='c' && c[4]=='k' && c[6]=='L' && c[7]=='o' && c[8]=='s' && c[9]=='t'){
system("color 04");
cout<<"-0.01";
}
else system(c);
cout<<endl;
//cout<<system(c)<<endl;
}
}
增加if…else并修改里面的内容即可实现新建命令
不知道为什么只能一个字符一个字符地比较,这里问一下为啥不能c==“string”;