跳到正文

个人记录

WKC Computer The operating system

Charles_with_wkc约 15 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 15 分钟

版本

  1. v1当前
C++
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
string s,k=" ";
int main(){
	system("title WKC Computer The operating system");
	cout<<"[Welcome to use WKC Computer The operating system]"<<endl;
	while(1){
		cout<<"[Please enter your instructions] ";
		cin>>s;
		if(s=="return"){
			cout<<"[Welcome to use nest time WKC Computer The operating system]"<<endl;
			break;
		}
		else if(s=="stack"){
			while(1){
				cout<<"[Please enter your instructions for the stack] ";
				cin>>s;
				stack<long long>str;
				long long a;
				if(s=="Texit"){
					break;
				}
				else if(s=="Ttop"){
					if(str.empty()){
						cout<<"[No stack top]"<<endl;
						continue;
					}
					cout<<str.top()<<"[Is the top element of the stack] "<<endl;
				}
				else if(s=="Tpush"){
					cin>>a;
					str.push(a);
					cout<<a<<" [Already on the stack] "<<endl;
				}
				else if(s=="Tpop"){
					cout<<str.top()<<" [Already off the stack] "<<endl;
					str.pop();
				}
				else if(s=="Tempty"){
					if(!str.empty()){
						cout<<"[This stack is not empty] "<<endl;
					}
					else{
						cout<<"[This stack is empty] "<<endl;
					}
				}
				else if(s=="Tsize"){
					cout<<"[This stack is not empty] "<<str.size()<<endl;
				}
				else{
					cout<<"[There is no such instruction] "<<endl;
				}
			}
		}
		else if(s=="ifon"){
			while(1){
				cout<<"[Please enter your instructions for the ifon] ";
				cin>>s;
				long long a,b;
				if(s=="ifoff"){
					break;
				}
				else if(s=="greater"){
					cin>>a>>b;
					if(a>b){
						cout<<"[A is greater than B] "<<endl;
					}
					else{
						cout<<"[A is not greater than B] "<<endl;
					}
				}
				else if(s=="less"){
					cin>>a>>b;
					if(a<b){
						cout<<"[A is less than B] "<<endl;
					}
					else{
						cout<<"[A is not less than B] "<<endl;
					}
				}
				else if(s=="equals"){
					cin>>a>>b;
					if(a==b){
						cout<<"[A is equals B] "<<endl;
					}
					else{
						cout<<"[A is not equals B] "<<endl;
					}
				}
				else{
					cout<<"[There is no such instruction] "<<endl;
				}
			}
		}
		else if(s=="sqrt"){
			long long a;
			cin>>a;
			cout<<sqrt(a)<<" [is Sqrt(A)] "<<endl;
		}
		else if(s=="asmdm"){
			double a,b;
			int an,bn;
			cin>>a>>b;
			an=int(a);
			bn=int(b);
			cout<<a+b<<" [is A add B] "<<endl;
			cout<<a-b<<" [is A subtract B] "<<endl;
			cout<<a*b<<" [is A multiply B] "<<endl;
			cout<<a/b<<" [is A divide B] "<<endl;
			if(a<0||b<0){
				cout<<"[A takes the module B has no result] "<<endl;
			}
			else{
				cout<<an%bn<<" [is A mold B] "<<endl;
			}
		}
		else if(s=="string"){
			string f=" ";
			stack<string>str;
			while(1){
				cout<<"[Please enter your instructions for the string] ";
				cin>>s;
				if(s=="S^E"){
					break;
				}
				else if(s=="S^I"){
					cin>>f;
					cout<<"[Input successful]"<<endl;
				}
				else if(s=="S^C"){
					str.push(f);
					cout<<"[For pasting results]"<<endl;
				}
				else if(s=="S^L"){
					f=" ";
					str.push(f);
					cout<<"[Already cleared]"<<endl;
				}
				else if(s=="S^A"){
					if(f==" "){
						cout<<"[None]"<<endl;
					}
					else{
						f=f+f;
						str.push(f);
						cout<<f<<" [For splicing results]"<<endl;
					}
				}
				else if(s=="S^V"){
					if(f==" "){
						cout<<"[None]"<<endl;
					}
					else{
						cout<<f<<" [For replication results]"<<endl;
					}
				}
				else if(s=="S^Z"){
					if(str.empty()){
						cout<<"[None]"<<endl;
					}
					else{
						str.pop();
						f=str.top();
						cout<<"[Return successful]"<<endl;
					}
				}
				else{
					cout<<"[There is no such instruction] "<<endl;
				}
			}
		}
		else if(s=="^C"){
			cin>>k;
			cout<<k<<" [For pasting results]"<<endl;
		}
		else if(s=="^V"){
			if(k==" "){
				cout<<"[None]"<<endl;
			}
			else{
				cout<<k<<" [For replication results]"<<endl;
			}
		}
		else if(s=="^L"){
			k=" ";
			cout<<"[Already cleared]"<<endl;
		}
		else if(s=="clean"){
			system("cls");
		}
		else if(s=="color0"){
			system("color 0");
		}
		else if(s=="color2"){
			system("color 2");
		}
		else if(s=="color3"){
			system("color 3");
		}
		else if(s=="color4"){
			system("color 4");
		}
		else if(s=="color5"){
			system("color 5");
		}
		else if(s=="color6"){
			system("color 6");
		}
		else if(s=="color7"){
			system("color 7");
		}
		else if(s=="color8"){
			system("color 8");
		}
		else if(s=="color9"){
			system("color 9");
		}
		else if(s=="colorA"){
			system("color A");
		}
		else if(s=="colorB"){
			system("color B");
		}
		else if(s=="colorC"){
			system("color C");
		}
		else if(s=="colorD"){
			system("color D");
		}
		else if(s=="colorE"){
			system("color E");
		}
		else if(s=="colorF"){
			system("color F");
		}
		else if(s=="view"){
			cout<<"[1.clean       		 :Screen cleaning]\n";
			cout<<"[2.stack      		 :Define the stack]\n";
			cout<<"[3.view       		 :View the function]\n";
			cout<<"[4.asmdm     		 :Add, subtract, multiply, divide and mould]\n";
			cout<<"[5.string     		 :Define the string]\n";
			cout<<"[6.color1    		 :Change the console color to blue]\n";
			cout<<"[7.color2    		 :Change the console color to green]\n";
			cout<<"[8.color3    		 :Change the console color to blue]\n";
			cout<<"[9.color4    		 :Change the console color to red]\n";
			cout<<"[10.color5    		 :Change the console color to purple]\n";
			cout<<"[11.color6    		 :Change the console color to yellow]\n";
			cout<<"[12.color7    		 :Change the console color to while]\n";
			cout<<"[13.color8    		 :Change the console color to grey]\n";
			cout<<"[14.color9    		 :Change the console color to blue]\n";
			cout<<"[15.colorA    		 :Change the console color to green]\n";
			cout<<"[16.colorB    		 :Change the console color to green]\n";
			cout<<"[17.colorC   		 :Change the console color to red]\n";
			cout<<"[18.colorD    		 :Change the console color to purple]\n";
			cout<<"[19.colorE    		 :Change the console color to yellow]\n";
			cout<<"[20.color0        	 :Change the console color to black]\n";
			cout<<"[21.sqrt       		 :Square root]\n";
			cout<<"[22.^L         		 :Clear]\n";
			cout<<"[23.^C         		 :Paste]\n";
			cout<<"[24.^V         		 :Copy]\n";
			cout<<"[25.ifon       		 :Than the size]\n";
			cout<<"[26.ifoff      		 :Exit for than the size]\n";
			cout<<"[27.greater    		 :Big for than the size]\n";
			cout<<"[28.less       		 :Small for than the size]\n";
			cout<<"[29.equals    		 :Same for than the size]\n";
			cout<<"[30.return    		 :Exit]\n";
			cout<<"[31.Texit     		 :Exit for stack]\n";
			cout<<"[32.Tpop      		 :Pop for stack]\n";
			cout<<"[33.Tpush     		 :Push for stack]\n";
			cout<<"[34.Tempty    		 :Empty for stack]\n";
			cout<<"[35.Tsize     		 :Size for stack]\n";
			cout<<"[36.S^E       		 :Exit for string]\n";
			cout<<"[37.S^I       		 :Cin for string]\n";
			cout<<"[38.S^C       		 :Paste for string]\n";
			cout<<"[39.S^L       		 :Clear for string]\n";
			cout<<"[40.S^V       		 :Copy for string]\n";
			cout<<"[41.S^Z       		 :Undo for string]\n";
			cout<<"[42.color0        	 :Change the console color to while]\n";
			cout<<"[43.system        	 :Open the system]\n";
			cout<<"[44.SYSexit        	 :Exit for system]\n";
			cout<<"[45.SYS-a        	 :Turn it off]\n";
			cout<<"[46.SYScalc        	 :Open the calc]\n";
		}
		else if(s=="system"){
			while(true){
				cout<<"[Please enter your instructions for the system] ";
				cin>>s;
				if(s=="SYSexit"){
					break;
				}
				else if(s=="SYS-a"){
					system("shutdown -s");
				}
				else if(s=="SYScalc"){
					system("calc");
				}
				else{
					cout<<"[There is no such instruction] "<<endl;
				}
			}
		}
		else{
			cout<<"[There is no such instruction] "<<endl;
		}
	}
	return 0;
}
原文