Cnle 用法与代码

· · 个人记录

代码

云剪贴板(1.0):https://www.luogu.com.cn/paste/tl9us1ue
云剪贴版(5.0):https://www.luogu.com.cn/paste/r45b62lv
云剪贴版(7.0):https://www.luogu.com.cn/paste/oh1b3ts1
云剪贴版(10.0): https://www.luogu.com.cn/paste/ulg2mayk
云剪贴版(12.0U): https://www.luogu.com.cn/paste/suygilni

1.0

#include <iostream>
#include <map>
#include <string>
#include <iomanip>
using namespace std;

struct nodef{
    int d;
    string s;
    string type;
};
map<string,nodef> def;
int retnum;
string fopr;//the first operator
const string out="<<< ",in=">>> ";
bool pd_is(int a,int b,string opr_is){
    if(opr_is=="bigger_than"){
        return (a>b);
    }
    if(opr_is=="smaller_than"){
        return (a<b);
    }
    if(opr_is=="equal_to"){
        return (a==b);
    }
    if(opr_is=="bigger_equal_to"){
        return (a>=b);
    }
    if(opr_is=="smaller_equal_to"){
        return (a<=b);
    }
    if(opr_is=="not_equal_to"){
        return (a!=b);
    }
    if(opr_is=="square_of"){
        return (b*b==a);
    }
}
bool pd_is(string a,string b,string opr_is){
    if(opr_is=="bigger_than"){
        return (a>b);
    }
    if(opr_is=="smaller_than"){
        return (a<b);
    }
    if(opr_is=="equal_to"){
        return (a==b);
    }
    if(opr_is=="bigger_equal_to"){
        return (a>=b);
    }
    if(opr_is=="smaller_equal_to"){
        return (a<=b);
    }
    if(opr_is=="not_equal_to"){
        return (a!=b);
    }
}
string btstr(bool in__bo){
    return (in__bo)?"True":"False";
}
int int_value(string name){
    return def[name].d;
}
string str_value(string name){
    return def[name].s;
}
string deftype(string name){
    return def[name].type;
}
bool isopr(string __in){
    return (__in==fopr);
}
int main(){
    cout<<"---------Cnle1.0正式版---------\n";
    for(int line=1;1;line++){
        cout<<"line"<<setw(5)<<line<<":\t";

        cin>>fopr;//input

        if(isopr("def")){
            //define num
            string def_name,def_type;
            cin>>def_type;
            while(1){
                cin>>def_name;
                if(def_type=="int"){
                    int def_value;
                    cin>>def_value;
                    def[def_name]={def_value,"","int"};
                }else if(def_type=="string"){
                    string def_value;
                    cin>>def_value;
                    def[def_name]={0,def_value,"string"};
                }else{
                    retnum=1;
                    break;
                }
                string and_;
                cin>>and_;
                if(and_=="none"){
                    break;
                }
            }
            //end
            //def int a (value,::int) and/none
            //def string a (value::string) and/none
        }else if(isopr("print")){
            cout<<out<<" ";
            while(1){
                string print_num_type;
                cin>>print_num_type;
                if(print_num_type==":def"){
                    string def_print_name;
                    cin>>def_print_name;
                    if(!def.count(def_print_name)){
                        retnum=3;
                        break;
                    }else if(deftype(def_print_name)=="int"){
                        cout<<int_value(def_print_name)<<" ";
                        //end
                    }else if(deftype(def_print_name)=="string"){
                        cout<<str_value(def_print_name)<<" ";
                        //end
                    }
                }else if(print_num_type==":str"){
                    string put_string;
                    cin>>put_string;
                    cout<<put_string;
                }else if(print_num_type==":is"){
                    string is_typename;
                    cin>>is_typename;
                    if(is_typename=="value"){
                        string is_type_a,is_type_b,is_type_opr;
                        cin>>is_type_a>>is_type_opr>>is_type_b;
                        if(!def.count(is_type_a) || !def.count(is_type_b)){
                            retnum=3;
                            break;
                        }if(deftype(is_type_a)=="int" && deftype(is_type_a)=="int"){
                            cout<<btstr(pd_is(int_value(is_type_a),int_value(is_type_b),is_type_opr))<<" ";
                        }else if(deftype(is_type_a)=="string" && deftype(is_type_a)=="string"){
                            cout<<btstr(pd_is(str_value(is_type_a),str_value(is_type_b),is_type_opr))<<" ";
                        }else{
                            retnum=4;
                            break;
                        }
                    }else if(is_typename=="number"){
                        string is_type;
                        cin>>is_type;
                        if(is_type=="int"){
                            int number_a,number_b;
                            string number_opr;
                            cin>>number_a>>number_opr>>number_b;
                            cout<<btstr(pd_is(number_a,number_b,number_opr))<<" ";
                        }else if(is_type=="string"){
                            string number_a,number_b;
                            string number_opr;
                            cin>>number_a>>number_opr>>number_b;
                            cout<<btstr(pd_is(number_a,number_b,number_opr))<<" ";
                        }
                    }
                }else{
                    retnum=2;
                    break;
                }
                string __and;
                cin>>__and;
                if(__and=="none"){
                    break;
                }
            }
            cout<<endl;
        }else if(isopr("no_line")){
            string no__line;
            cin>>no__line;
        }else if(isopr("end::main")){
            break;
        }
    }
    cout<<"--------------------------------\n";
    if(retnum==0){
        cout<<"This program is return.No error.\n"<<"Put the keyboard to continue. . .";
    }else if(retnum==1){
        cout<<"This program is return."<<"[error]the def_opr was not the type.\n"<<"Put the keyboard to continue. . .";
    }else if(retnum==2){
        cout<<"This program is return."<<"[error]the print_opr was not the type.\n"<<"Put the keyboard to continue. . .";
    }else if(retnum==3){
        cout<<"This program is return."<<"[error]the def was not define!\n"<<"Put the keyboard to continue. . .";
    }else if(retnum==4){
        cout<<"This program is return."<<"[error]the print_num_value type was diffrent!\n"<<"Put the keyboard to continue. . .";
    }else{
        cout<<"None [error]!!!";
    }
    return 0;
}

5.0

#include <iostream>
#include <map>
#include <string>
#include <iomanip>
#include <cmath>
#include <stdexcept>
#include <queue>
#include <stack>
#include <windows.h>
using namespace std;
void SetColor(int ForgC, int BackC) {
    WORD wColor = ((BackC & 0x0F) << 4) + (ForgC & 0x0F);
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), wColor);
}
void SetColor(int ForgC) {
    WORD wColor;
    HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_SCREEN_BUFFER_INFO csbi;

    if(GetConsoleScreenBufferInfo(hStdOut, &csbi)) {
        wColor = csbi.wAttributes;
        wColor = (wColor & 0xFFF0) + ForgC;
        SetConsoleTextAttribute(hStdOut, wColor);
    }
}
void SetConsoleColor(WORD attributes) {
    HANDLE hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hConsoleOutput, attributes);
}
struct nodef {
    int d;
    double lf;
    string s;
    string type;
    string type_sq;
};
map<string, nodef> def;
map<string, queue<int>> qi_def;
map<string, stack<int>> si_def;
map<string, queue<string>> qs_def;
map<string, stack<string>> ss_def;
map<string, queue<double>> qd_def;
map<string, stack<double>> sd_def;

int retnum;
string fopr;//the first operator
const string out = "out<<< ", in = "in>>> ";
bool pd_is(int a, int b, string opr_is) {
    if (opr_is == "bigger_than" || opr_is == ">") {
        return (a > b);
    }
    if (opr_is == "smaller_than" || opr_is == "<") {
        return (a < b);
    }
    if (opr_is == "equal_to" || opr_is == "==") {
        return (a == b);
    }
    if (opr_is == "bigger_equal_to" || opr_is == ">=") {
        return (a >= b);
    }
    if (opr_is == "smaller_equal_to" || opr_is == "<=") {
        return (a <= b);
    }
    if (opr_is == "not_equal_to" || opr_is == "!=") {
        return (a != b);
    }
    if (opr_is == "square_of" || opr_is == "#=") {
        return (b * b == a);
    }
    throw runtime_error("No the opr_is!");
}
bool pd_is(double a, double b, string opr_is) {
    if (opr_is == "bigger_than" || opr_is == ">") {
        return (a > b);
    }
    if (opr_is == "smaller_than" || opr_is == "<") {
        return (a < b);
    }
    if (opr_is == "equal_to" || opr_is == "==") {
        return (a == b);
    }
    if (opr_is == "bigger_equal_to" || opr_is == ">=") {
        return (a >= b);
    }
    if (opr_is == "smaller_equal_to" || opr_is == "<=") {
        return (a <= b);
    }
    if (opr_is == "not_equal_to" || opr_is == "!=") {
        return (a != b);
    }
    if (opr_is == "square_of" || opr_is == "#=") {
        return (b * b == a);
    }
    throw runtime_error("No the opr_is!");
}
bool pd_is(string a, string b, string opr_is) {
    if (opr_is == "bigger_than" || opr_is == ">") {
        return (a > b);
    }
    if (opr_is == "smaller_than" || opr_is == "<") {
        return (a < b);
    }
    if (opr_is == "equal_to" || opr_is == "==") {
        return (a == b);
    }
    if (opr_is == "bigger_equal_to" || opr_is == ">=") {
        return (a >= b);
    }
    if (opr_is == "smaller_equal_to" || opr_is == "<=") {
        return (a <= b);
    }
    if (opr_is == "not_equal_to" || opr_is == "!=") {
        return (a != b);
    }
    throw runtime_error("No the opr_is!");
}
string btstr(bool in__bo) {
    return (in__bo) ? "True" : "False";
}
double double_value(string name) {
    return def[name].lf;
}
int int_value(string name) {
    return def[name].d;
}
string str_value(string name) {
    return def[name].s;
}
string deftype(string name) {
    return def[name].type;
}
bool isopr(string __in) {
    return (__in == fopr);
}
void let(string name_a, string name_b, string let_to_opr, string type) {
    if (type == "int") {
        if (let_to_opr == "plus" || let_to_opr == "+=") {
            def[name_a].d += def[name_b].d;
        } else if (let_to_opr == "minus" || let_to_opr == "-=") {
            def[name_a].d -= def[name_b].d;
        } else if (let_to_opr == "times" || let_to_opr == "*=") {
            def[name_a].d *= def[name_b].d;
        } else if (let_to_opr == "divide" || let_to_opr == "/=") {
            def[name_a].d /= def[name_b].d;
        } else if (let_to_opr == "mod" || let_to_opr == "%=") {
            def[name_a].d %= def[name_b].d;
        } else if (let_to_opr == "and" || let_to_opr == "&&=") {
            def[name_a].d &= def[name_b].d;
        } else if (let_to_opr == "or" || let_to_opr == "||=") {
            def[name_a].d |= def[name_b].d;
        } else if (let_to_opr == "xor" || let_to_opr == "^^=") {
            def[name_a].d ^= def[name_b].d;
        } else if (let_to_opr == "nor" || let_to_opr == "!|=") {
            def[name_a].d = ~(def[name_a].d | def[name_b].d);
        } else if (let_to_opr == "lshift" || let_to_opr == "<<=") {
            def[name_a].d <<= def[name_b].d;
        } else if (let_to_opr == "rshift" || let_to_opr == ">>=") {
            def[name_a].d >>= def[name_b].d;
        } else if (let_to_opr == "nxor" || let_to_opr == "!^=") {
            def[name_a].d = ~(def[name_a].d ^ def[name_b].d);
        } else if (let_to_opr == "nand" || let_to_opr == "!&=") {
            def[name_a].d = ~(def[name_a].d ^ def[name_b].d);
        } else if (let_to_opr == "pow" || let_to_opr == "^=") {
            def[name_a].d = int(pow(def[name_a].d, def[name_b].d));
        } else {
            throw runtime_error("The let is error.");
        }
    } else if (type == "string") {
        if (let_to_opr == "plus" || let_to_opr == "+=") {
            def[name_a].s += def[name_b].s;
        } else {
            throw runtime_error("The let is error.");
        }
    } else if (type == "double") {
        if (let_to_opr == "plus" || let_to_opr == "+=") {
            def[name_a].lf += def[name_b].lf;
        } else if (let_to_opr == "minus" || let_to_opr == "-=") {
            def[name_a].lf -= def[name_b].lf;
        } else if (let_to_opr == "times" || let_to_opr == "*=") {
            def[name_a].lf *= def[name_b].lf;
        } else if (let_to_opr == "divide" || let_to_opr == "/=") {
            def[name_a].lf /= def[name_b].lf;
        } else if (let_to_opr == "mod" || let_to_opr == "%=") {
            def[name_a].d = fmod(def[name_a].lf, def[name_b].lf);
        } else if (let_to_opr == "pow" || let_to_opr == "^=") {
            def[name_a].d = pow(def[name_a].lf, def[name_b].lf);
        } else {
            throw runtime_error("The let is error.");
        }
    }
}
int main() {
    SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE);
    SetColor(FOREGROUND_BLUE);
    cout<<"-------------[Cnle5.0]---------\n";
    for (int line = 1; 1; line++) {
        SetColor(FOREGROUND_RED);
        cout<<"line("<<line<<")  ";
        SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
        cin >> fopr; //input

        if (isopr("def")) {
            //define num
            string def_name, def_type;
            bool flag = false;
            cin >> def_type;
            while (1) {
                cin >> def_name;
                if (def.count(def_name)) {
                    retnum = 100;
                    flag = true;
                    break;
                }
                if (def_type == "int") {
                    int def_value;
                    cin >> def_value;
                    def[def_name] = {def_value, 0, "", "int", "none"};
                } else if (def_type == "string") {
                    string def_value;
                    cin >> def_value;
                    def[def_name] = {0, 0, def_value, "string", "none"};
                } else if (def_type == "double") {
                    double def_value;
                    cin >> def_value;
                    def[def_name] = {0, def_value, "", "double", "none"};
                } else if (def_type == "stack<int>") {
                    def[def_name] = {0, 0, "", "stack", "int"};
                } else if (def_type == "stack<string>") {
                    def[def_name] = {0, 0, "", "stack", "string"};
                } else if (def_type == "stack<double>") {
                    def[def_name] = {0, 0, "", "stack", "double"};
                } else if (def_type == "queue<int>") {
                    def[def_name] = {0, 0, "", "queue", "int"};
                } else if (def_type == "queue<string>") {
                    def[def_name] = {0, 0, "", "queue", "string"};
                } else if (def_type == "queue<double>") {
                    def[def_name] = {0, 0, "", "queue", "double"};
                } else {
                    retnum = 1;
                    flag = true;
                    break;
                }
                string and_;
                cin >> and_;
                if (and_ == "none" || and_ == ";") {
                    break;
                } else if (and_ != "and" && and_ != ",") {
                    retnum = 100;
                    flag = true;
                    break;
                }
            }
            if (flag) {
                break;
            }
            //end
            //def int a (value,::int) and/none
            //def string a (value::string) and/none
        } else if (isopr("print")) {
            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
            cout << out << " ";
            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
            bool flag = false;
            while (1) {
                string print_num_type;
                cin >> print_num_type;
                if (print_num_type == ":def") {
                    string def_print_name;
                    cin >> def_print_name;
                    if (!def.count(def_print_name)) {
                        retnum = 3;
                        flag = true;
                        break;
                    } else if (deftype(def_print_name) == "int") {
                        SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
                        cout << int_value(def_print_name) << " ";
                        SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
                        //end
                    } else if (deftype(def_print_name) == "string") {
                        SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
                        cout << str_value(def_print_name) << " ";
                        SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
                        //end
                    } else if (deftype(def_print_name) == "double") {
                        SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
                        cout << double_value(def_print_name) << " ";
                        SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
                        //end
                    } else {
                        retnum = 2;
                        flag = true;
                        break;
                    }
                } else if (print_num_type == ":str") {
                    string put_string;
                    cin >> put_string;

                    SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
                    cout << put_string << " ";
                    SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
                } else if (print_num_type == ":is") {
                    string is_typename;
                    cin >> is_typename;
                    if (is_typename == "value") {
                        string is_type_a, is_type_b, is_type_opr;
                        cin >> is_type_a >> is_type_opr >> is_type_b;
                        if (!def.count(is_type_a) || !def.count(is_type_b)) {
                            retnum = 3;
                            flag = true;
                            break;
                        }
                        if (deftype(is_type_a) == "int" && deftype(is_type_a) == "int") {
                            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
                            cout << btstr(pd_is(int_value(is_type_a), int_value(is_type_b), is_type_opr)) << " ";
                            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
                        } else if (deftype(is_type_a) == "string" && deftype(is_type_a) == "string") {
                            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
                            cout << btstr(pd_is(str_value(is_type_a), str_value(is_type_b), is_type_opr)) << " ";
                            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
                        } else if (deftype(is_type_a) == "double" && deftype(is_type_a) == "double") {
                            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
                            cout << btstr(pd_is(double_value(is_type_a), double_value(is_type_b), is_type_opr)) << " ";
                            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
                        } else {
                            retnum = 4;
                            flag = true;
                            break;
                        }
                    } else if (is_typename == "number") {
                        string is_type;
                        cin >> is_type;
                        if (is_type == "int") {
                            int number_a, number_b;
                            string number_opr;
                            cin >> number_a >> number_opr >> number_b;
                            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
                            cout << btstr(pd_is(number_a, number_b, number_opr)) << " ";
                            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);

                        } else if (is_type == "string") {
                            string number_a, number_b;
                            string number_opr;
                            cin >> number_a >> number_opr >> number_b;
                            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
                            cout << btstr(pd_is(number_a, number_b, number_opr)) << " ";
                            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
                        } else if (is_type == "double") {
                            double number_a, number_b;
                            string number_opr;
                            cin >> number_a >> number_opr >> number_b;
                            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
                            cout << btstr(pd_is(number_a, number_b, number_opr)) << " ";
                            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
                        } else {
                            retnum = 100;
                            flag = true;
                            break;
                        }
                    }
                } else {
                    retnum = 2;
                    break;
                }
                string __and;
                cin >> __and;
                if (__and == "none" || __and == ";") {
                    break;
                } else if (__and != "and" && __and != ",") {
                    retnum = 100;
                    flag = true;
                    break;
                }
            }
            cout << endl;
            if (flag) {
                break;
            }
        } else if (isopr("no_line")) {
            string no__line;
            cin >> no__line;
        } else if (isopr("let")) {
            string let_a, let_b, let_opr;
            cin >> let_a >> let_opr >> let_b;
            if (deftype(let_a) != deftype(let_b) || !(deftype(let_a) == "string" || deftype(let_a) == "int")) {
                retnum = 6;
                break;
            } else if ((deftype(let_a) == "string" || deftype(let_b) == "string") && let_opr != "plus" && let_opr != "+=") {
                retnum = 5;
                break;
            } else {
                let(let_a, let_b, let_opr, deftype(let_a));
            }
        } else if (isopr("stack")) {
            string name, stack_do;
            cin >> name >> stack_do;
            if (stack_do == "push") {
                if (def[name].type_sq == "int") {
                    int push_v;
                    cin >> push_v;
                    si_def[name].push(push_v);
                } else if (def[name].type_sq == "string") {
                    string push_v;
                    cin >> push_v;
                    ss_def[name].push(push_v);
                } else if (def[name].type_sq == "double") {
                    double push_v;
                    cin >> push_v;
                    sd_def[name].push(push_v);
                } else {
                    retnum = 100;
                    break;
                }

            } else if (stack_do == "pop") {
                if (def[name].type_sq == "int") {
                    si_def[name].pop();
                } else if(def[name].type_sq == "string") {
                    ss_def[name].pop();
                } else if(def[name].type_sq == "double") {
                    sd_def[name].pop();
                } else {
                    retnum = 100;
                    break;
                }
            } else if (stack_do == "top") {
                if (def[name].type_sq == "int") {
                    cout<<out<<si_def[name].top()<<endl;
                } else if(def[name].type_sq == "string") {
                    cout<<out<<ss_def[name].top()<<endl;
                } else if(def[name].type_sq == "double") {
                    cout<<out<<sd_def[name].top()<<endl;
                } else {
                    retnum = 100;
                    break;
                }
            } else {
                retnum = 100;
                break;
            }
        } else if (isopr("queue")) {
            string name, queue_do;
            cin >> name >> queue_do;
            if (queue_do == "push") {
                if (def[name].type_sq == "int") {
                    int push_v;
                    cin >> push_v;
                    qi_def[name].push(push_v);
                } else if (def[name].type_sq == "string") {
                    string push_v;
                    cin >> push_v;
                    qs_def[name].push(push_v);
                } else if (def[name].type_sq == "double") {
                    double push_v;
                    cin >> push_v;
                    qd_def[name].push(push_v);
                } else {
                    retnum = 100;
                    break;
                }

            } else if (queue_do == "pop") {
                if (def[name].type_sq == "int") {
                    qi_def[name].pop();
                } else if(def[name].type_sq == "string") {
                    qs_def[name].pop();
                } else if(def[name].type_sq == "double") {
                    qd_def[name].pop();
                } else {
                    retnum = 100;
                    break;
                }
            } else if (queue_do == "front") {
                if (def[name].type_sq == "int") {
                    cout<<out<<qi_def[name].front()<<endl;
                } else if(def[name].type_sq == "string") {
                    cout<<out<<qs_def[name].front()<<endl;
                } else if(def[name].type_sq == "double") {
                    cout<<out<<qd_def[name].front()<<endl;
                } else {
                    retnum = 100;
                    break;
                }
            } else {
                retnum = 100;
                break;
            }
        } else if (isopr("to")) {
            string a_type, a_name, dt;
            cin >> a_name >> a_type;
            dt = deftype(a_name);
            if (a_type != deftype(a_name)) {
                if (dt == "string") {
                    if (a_type == "int") {
                        int those_num = 0;
                        bool is_n = 1;
                        string thstr = str_value(a_name);
                        for (int i = 0; i < int(thstr.length()); i++) {
                            if (thstr[i] == '-') {
                                if (i == 0) {
                                    is_n = 0;
                                } else {
                                    retnum = 100;
                                    break;
                                }
                            } else {
                                those_num = those_num * 10 + thstr[i] - 48;
                            }
                        }
                        def[a_name].d = (is_n) ? those_num : (-those_num);
                        def[a_name].s = "";
                        def[a_name].type = "int";
                    } else if (a_type == "double") {
                        double it = 0, those_num = 0, down = 0;
                        bool is_n = 1, flag = 0, kflag = false;
                        string thstr = str_value(a_name);
                        for (int i = 0; i < int(thstr.length()); i++) {
                            if (thstr[i] == '-') {
                                if (i == 0) {
                                    is_n = 0;
                                } else {
                                    kflag = true;
                                    retnum = 100;
                                    break;
                                }
                            } else if (thstr[i] == '.') {
                                if (i == 0) {
                                    retnum = 100;
                                    kflag = true;
                                    break;
                                } else {
                                    flag = true;
                                }
                            } else if (thstr[i] >= '0' && thstr[i] <= '9') {
                                if (flag) {
                                    down = down * 10.0 + thstr[i] - 48.0;
                                    it++;
                                } else {
                                    those_num = those_num * 10.0 + thstr[i] - 48.0;
                                }
                            } else {
                                retnum = 100;
                                kflag = true;
                                break;
                            }
                        }
                        those_num += down / pow(10, it);
                        def[a_name].lf = (is_n) ? those_num : (-those_num);
                        if (kflag) {
                            break;
                        }
                    } else {
                        retnum = 100;
                        break;
                    }
                } else if (dt == "double") {
                    if (a_type == "int") {
                        def[a_name].d = floor(int_value(a_name));
                        def[a_name].lf = 0;
                        def[a_name].type = "int";
                    } else if (a_type == "string") {
                        retnum = 100;
                        break;
                    }
                } else if (dt == "int") {
                    if (a_type == "double") {
                        def[a_name].lf = double(int_value(a_name));
                        def[a_name].type = "double";
                    } else if (a_type == "string") {
                        string itstr = "";
                        int thisint = int_value(a_name);
                        while (thisint) {
                            itstr += char(thisint % 10 + '0');
                            thisint /= 10;
                        }
                        def[a_name].s = itstr;
                        def[a_name].type = "string";
                    } else {
                        retnum = 100;
                        break;
                    }
                } else {
                    retnum = 100;
                    break;
                }
            }
        } else if (isopr("type")) {
            string name;
            cin >> name;
            SetConsoleColor(FOREGROUND_RED | FOREGROUND_GREEN);
            cout << out << deftype(name) << endl;
            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
        } else if (isopr("end")) {
            cout << endl;
            retnum = 0;
            break;
        } else {
            retnum = 8;
            break;
        }
    }
    cout << "--------------------------------\n";
    if (retnum == 0) {
        cout << "This program is return.No error.\n" << "Put the keyboard to continue. . .";
    } else if (retnum == 1) {
        cout << "This program is return." << "[error]the def_opr was not the type.\n" << "Put the keyboard to continue. . .";
    } else if (retnum == 2) {
        cout << "This program is return." << "[error]the print_opr was not the type.\n" << "Put the keyboard to continue. . .";
    } else if (retnum == 3) {
        cout << "This program is return." << "[error]the def was not define!\n" << "Put the keyboard to continue. . .";
    } else if (retnum == 4) {
        cout << "This program is return." << "[error]the print or let to num_value\'s type was diffrent!\n" << "Put the keyboard to continue. . .";
    } else if (retnum == 5) {
        cout << "This program is return." << "[error]the string cannot to other comput the plus and minus!\n" << "Put the keyboard to continue. . .";
    } else if (retnum == 6) {
        cout << "This program is return." << "[error]the let was error.\n" << "Put the keyboard to continue. . .";
    } else if (retnum == 8) {
        cout << "This program is return." << "[error]the type was not defined!\n" << "Put the keyboard to continue. . .";
    } else {
        cout << "This program is return." << "[error]unkown error\n" << "Put the keyboard to continue. . .";
    }
    return 0;
}

6.0

#include <iostream>
#include <map>
#include <string>
#include <iomanip>
#include <cmath>
#include <stdexcept>
#include <queue>
#include <stack>
#include <windows.h>

using namespace std;

#define NONE_ERR          0
#define OPR_NOT_TYPE      1
#define DEF_NOT_DEFINE    2
#define DEF_IS_DEFINED    3
#define LET_ERROR         4
#define TO_ERROR          5
#define PRINT_TYPE_ERROR  6
#define DEF_TYPE_ERROR    7
#define TYPE_NOT_INT      8
#define TYPE_NOT_STR      9
#define TYPE_NOT_DOUBLE   10
#define QUEUE_ERROR       11
#define STACK_ERROR       12
#define UNKNOW_ERROR      100000

typedef const int IS_CNLE_ERROR;


void end_cnle(IS_CNLE_ERROR ERR) {
    std::cout << "--------------------------------\n";
    std::cout << "This program is return.";
    switch (ERR) {
        case NONE_ERR:
            std::cout << "This program is return.No error.";
            break;
        case OPR_NOT_TYPE:
            std::cout << "[error]The opr is not the type.";
            break;
        case DEF_NOT_DEFINE:
            std::cout << "[error]The def is not define!";
            break;
        case DEF_IS_DEFINED:
            std::cout << "[error]The def was defined!";
            break;
        case LET_ERROR:
            std::cout << "[error]The let was error.";
            break;
        case TO_ERROR:
            std::cout << "[error]The to was error.";
            break;
        case PRINT_TYPE_ERROR:
            std::cout << "[error]The print type was not a type.";
            break;
        case DEF_TYPE_ERROR:
            std::cout << "[error]The def type was not a type.";
            break;
        case TYPE_NOT_INT:
            std::cout << "[error]The def type was not int.";
            break;
        case TYPE_NOT_STR:
            std::cout << "[error]The def type was not string.";
            break;
        case TYPE_NOT_DOUBLE:
            std::cout << "[error]The def type was not double.";
            break;
        case STACK_ERROR:
            std::cout << "[error]The stack was error.";
            break;
        case QUEUE_ERROR:
            std::cout << "[error]The queue was error.";
            break;
        default:
            std::cout << "[error]unkown error";
            break;
    }
    std::cout << "\nPut the keyboard to continue. . .";
}
std::string operator*(std::string __a, int __b) {
    if (!__b) {
        return "";
    }
    std::string ___ans = "";
    for (int ___it = 1; ___it <= __b; ___it++) {
        ___ans += __a;
    }
    return ___ans;
}
void operator*=(std::string &__a, int __b) {
    std::string ___ans = "";
    for (int ___it = 1; ___it <= __b; ___it++) {
        ___ans += __a;
    }
    __a = ___ans;
}
std::string operator/(std::string __a, int __b) {
    std::string ___ans = "";
    int ___len = __a.size() / __b;
    for (int ___it = 0; ___it < ___len; ___it++) {
        ___ans += __a[___it];
    }
    return ___ans;
}
void operator/=(std::string &__a, int __b) {
    std::string ___ans = "";
    int ___len = __a.size() / __b;
    for (int ___it = 0; ___it < ___len; ___it++) {
        ___ans += __a[___it];
    }
    __a = ___ans;
}
void SetColor(int ForgC, int BackC) {
    WORD wColor = ((BackC & 0x0F) << 4) + (ForgC & 0x0F);
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), wColor);
}
void SetColor(int ForgC) {
    WORD wColor;
    HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_SCREEN_BUFFER_INFO csbi;

    if (GetConsoleScreenBufferInfo(hStdOut, &csbi)) {
        wColor = csbi.wAttributes;
        wColor = (wColor & 0xFFF0) + ForgC;
        SetConsoleTextAttribute(hStdOut, wColor);
    }
}
void SetConsoleColor(WORD attributes) {
    HANDLE hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hConsoleOutput, attributes);
}

struct nodef {
    int d;
    double lf;
    string s;
    string type;
    string type_sq;
};
map<string, nodef> def;
map<string, queue<int>> qi_def;
map<string, stack<int>> si_def;
map<string, queue<string>> qs_def;
map<string, stack<string>> ss_def;
map<string, queue<double>> qd_def;
map<string, stack<double>> sd_def;

int retnum;
string fopr;//the first operator
const string out = "out<<< ", in = "in>>> ";

inline int Fib(int __x) {
    if (__x == 1) {
        return 1;
    } else if (__x == 2) {
        return 2;
    }
    int ___a_number__ = 1, ___b_number__ = 2, ___c_number__;
    for (int i = 3; i <= __x; i++) {
        ___c_number__ = ___a_number__ + ___b_number__;
        ___a_number__ = ___b_number__;
        ___b_number__ = ___c_number__;
    }
    return ___b_number__;
}
inline is_prime(int in) {
    if (in == 2) {
        return true;
    }
    if (in == 0 || in == 1 || in % 2 == 0) {
        return false;
    }
    for (int i = 3; i * i <= in; i += 2) {
        if (!(in % i)) {
            return false;
        }
    }
    return true;
}
std::string btstr(bool in__bo) {
    return (in__bo) ? "True" : "False";
}
double double_value(std::string name) {
    return def[name].lf;
}
int int_value(std::string name) {
    return def[name].d;
}
std::string str_value(std::string name) {
    return def[name].s;
}
std::string deftype(std::string name) {
    return def[name].type;
}
bool isopr(std::string __in) {
    return (__in == fopr);
}

bool pd_is(int a, int b, std::string opr_is) {
    if (opr_is == "bigger_than" || opr_is == ">") {
        return (a > b);
    }
    if (opr_is == "smaller_than" || opr_is == "<") {
        return (a < b);
    }
    if (opr_is == "equal_to" || opr_is == "==") {
        return (a == b);
    }
    if (opr_is == "bigger_equal_to" || opr_is == ">=") {
        return (a >= b);
    }
    if (opr_is == "smaller_equal_to" || opr_is == "<=") {
        return (a <= b);
    }
    if (opr_is == "not_equal_to" || opr_is == "!=") {
        return (a != b);
    }
    if (opr_is == "square_of" || opr_is == "#=") {
        return (b * b == a);
    }
    throw runtime_error("No the opr_is!");
}
bool pd_is(double a, double b, string opr_is) {
    if (opr_is == "bigger_than" || opr_is == ">") {
        return (a > b);
    }
    if (opr_is == "smaller_than" || opr_is == "<") {
        return (a < b);
    }
    if (opr_is == "equal_to" || opr_is == "==") {
        return (a == b);
    }
    if (opr_is == "bigger_equal_to" || opr_is == ">=") {
        return (a >= b);
    }
    if (opr_is == "smaller_equal_to" || opr_is == "<=") {
        return (a <= b);
    }
    if (opr_is == "not_equal_to" || opr_is == "!=") {
        return (a != b);
    }
    if (opr_is == "square_of" || opr_is == "#=") {
        return (b * b == a);
    }
    throw runtime_error("No the opr_is!");
}
bool pd_is(string a, string b, string opr_is) {
    if (opr_is == "bigger_than" || opr_is == ">") {
        return (a > b);
    }
    if (opr_is == "smaller_than" || opr_is == "<") {
        return (a < b);
    }
    if (opr_is == "equal_to" || opr_is == "==") {
        return (a == b);
    }
    if (opr_is == "bigger_equal_to" || opr_is == ">=") {
        return (a >= b);
    }
    if (opr_is == "smaller_equal_to" || opr_is == "<=") {
        return (a <= b);
    }
    if (opr_is == "not_equal_to" || opr_is == "!=") {
        return (a != b);
    }
    throw runtime_error("No the opr_is!");
}

int let(string name_a, string name_b, string let_to_opr) {
    string tp_a = deftype(name_a), tp_b = deftype(name_b), type;
    if (tp_a != tp_b) {
        return LET_ERROR;
    }
    type = tp_a;
    if (type == "int") {
        if (let_to_opr == "is" || let_to_opr == "=") {
            def[name_a].d += def[name_b].d;
        } else if (let_to_opr == "plus" || let_to_opr == "+=") {
            def[name_a].d += def[name_b].d;
        } else if (let_to_opr == "minus" || let_to_opr == "-=") {
            def[name_a].d -= def[name_b].d;
        } else if (let_to_opr == "times" || let_to_opr == "*=") {
            def[name_a].d *= def[name_b].d;
        } else if (let_to_opr == "divide" || let_to_opr == "/=") {
            def[name_a].d /= def[name_b].d;
        } else if (let_to_opr == "mod" || let_to_opr == "%=") {
            def[name_a].d %= def[name_b].d;
        } else if (let_to_opr == "and" || let_to_opr == "&&=") {
            def[name_a].d &= def[name_b].d;
        } else if (let_to_opr == "or" || let_to_opr == "||=") {
            def[name_a].d |= def[name_b].d;
        } else if (let_to_opr == "xor" || let_to_opr == "^^=") {
            def[name_a].d ^= def[name_b].d;
        } else if (let_to_opr == "nor" || let_to_opr == "!|=") {
            def[name_a].d = ~(def[name_a].d | def[name_b].d);
        } else if (let_to_opr == "lshift" || let_to_opr == "<<=") {
            def[name_a].d <<= def[name_b].d;
        } else if (let_to_opr == "rshift" || let_to_opr == ">>=") {
            def[name_a].d >>= def[name_b].d;
        } else if (let_to_opr == "nxor" || let_to_opr == "!^=") {
            def[name_a].d = ~(def[name_a].d ^ def[name_b].d);
        } else if (let_to_opr == "nand" || let_to_opr == "!&=") {
            def[name_a].d = ~(def[name_a].d ^ def[name_b].d);
        } else if (let_to_opr == "pow" || let_to_opr == "^=") {
            def[name_a].d = int(pow(def[name_a].d, def[name_b].d));
        } else {
            return LET_ERROR;
        }
    } else if (type == "string") {
        if (let_to_opr == "is" || let_to_opr == "=") {
            def[name_a].s += def[name_b].s;
        } else if (let_to_opr == "plus" || let_to_opr == "+=") {
            def[name_a].s += def[name_b].s;
        } else {
            return LET_ERROR;
        }
    } else if (type == "double") {
        if (let_to_opr == "is" || let_to_opr == "=") {
            def[name_a].lf = def[name_b].lf;
        } else if (let_to_opr == "plus" || let_to_opr == "+=") {
            def[name_a].lf += def[name_b].lf;
        } else if (let_to_opr == "minus" || let_to_opr == "-=") {
            def[name_a].lf -= def[name_b].lf;
        } else if (let_to_opr == "times" || let_to_opr == "*=") {
            def[name_a].lf *= def[name_b].lf;
        } else if (let_to_opr == "divide" || let_to_opr == "/=") {
            def[name_a].lf /= def[name_b].lf;
        } else if (let_to_opr == "mod" || let_to_opr == "%=") {
            def[name_a].d = fmod(def[name_a].lf, def[name_b].lf);
        } else if (let_to_opr == "pow" || let_to_opr == "^=") {
            def[name_a].d = pow(def[name_a].lf, def[name_b].lf);
        } else {
            return LET_ERROR;
        }
    }
    return 0;
}
int math() {
    string type;
    cin >> type;
    if (type == "fib") {
        string name_fib, name_to;
        cin >> name_fib >> name_to;
        if (!def.count(name_fib) || (!def.count(name_to) && name_to != "print")) {
            retnum = DEF_NOT_DEFINE;
            return -1;
        }
        if (deftype(name_fib) != "int") {
            retnum = TYPE_NOT_INT;
            return -1;
        }
        if (name_to == "print") {
            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
            cout << out << Fib(int_value(name_fib)) << endl;
            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
        } else {
            def[name_to].d = Fib(int_value(name_fib));
        }
        return 0;
    } else if (type == "sin") {
        string name_sin, name_to;
        cin >> name_sin >> name_to;
        if (!def.count(name_sin) || (!def.count(name_to) && name_to != "print")) {
            retnum = DEF_NOT_DEFINE;
            return -1;
        }
        if (deftype(name_sin) != "double") {
            retnum = TYPE_NOT_DOUBLE;
            return -1;
        }
        if (name_to == "print") {
            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
            cout << out << sin(double_value(name_sin)) << endl;
            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
        } else {
            def[name_to].lf = sin(double_value(name_sin));
        }
        return 0;
    } else if (type == "cos") {
        string name_cos, name_to;
        cin >> name_cos >> name_to;
        if (!def.count(name_cos) || (!def.count(name_to) && name_to != "print")) {
            retnum = DEF_NOT_DEFINE;
            return -1;
        }
        if (deftype(name_cos) != "double") {
            retnum = TYPE_NOT_DOUBLE;
            return -1;
        }
        if (name_to == "print") {
            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
            cout << out << cos(double_value(name_cos)) << endl;
            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
        } else {
            def[name_to].lf = sin(double_value(name_cos));
        }
        return 0;
    } else if (type == "tan") {
        string name_tan, name_to;
        cin >> name_tan >> name_to;
        if (!def.count(name_tan) || !def.count(name_to)) {
            retnum = DEF_NOT_DEFINE;
            return -1;
        }
        if (deftype(name_tan) != "double") {
            retnum = TYPE_NOT_DOUBLE;
            return -1;
        }
        if (name_to == "print") {
            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
            cout << out << sin(double_value(name_tan)) << endl;
            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
        } else {
            def[name_to].lf = sin(double_value(name_tan));
        }
        return 0;
    } else {
        return -1;
    }
}

int main() {
    SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE);
    SetColor(FOREGROUND_BLUE);
    cout << "-------------[Cnle6.0]---------\n";
    for (int line = 1; 1; line++) {
        SetColor(FOREGROUND_RED);
        cout << "line(" << line << ")  ";
        SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
        cin >> fopr; //input

        if (isopr("def")) {
            //define num
            string def_name, def_type;
            bool flag = false;
            cin >> def_type;
            while (1) {
                cin >> def_name;
                if (def.count(def_name)) {
                    retnum = DEF_IS_DEFINED;
                    flag = true;
                    break;
                }
                if (def_type == "int") {
                    int def_value;
                    cin >> def_value;
                    def[def_name] = {def_value, 0, "", "int", "none"};
                } else if (def_type == "string") {
                    string def_value;
                    cin >> def_value;
                    def[def_name] = {0, 0, def_value, "string", "none"};
                } else if (def_type == "double") {
                    double def_value;
                    cin >> def_value;
                    def[def_name] = {0, def_value, "", "double", "none"};
                } else if (def_type == "stack<int>") {
                    def[def_name] = {0, 0, "", "stack", "int"};
                } else if (def_type == "stack<string>") {
                    def[def_name] = {0, 0, "", "stack", "string"};
                } else if (def_type == "stack<double>") {
                    def[def_name] = {0, 0, "", "stack", "double"};
                } else if (def_type == "queue<int>") {
                    def[def_name] = {0, 0, "", "queue", "int"};
                } else if (def_type == "queue<string>") {
                    def[def_name] = {0, 0, "", "queue", "string"};
                } else if (def_type == "queue<double>") {
                    def[def_name] = {0, 0, "", "queue", "double"};
                } else {
                    retnum = DEF_TYPE_ERROR;
                    flag = true;
                    break;
                }
                string and_;
                cin >> and_;
                if (and_ == "none" || and_ == ";") {
                    break;
                } else if (and_ != "and" && and_ != ",") {
                    retnum = UNKNOW_ERROR;
                    flag = true;
                    break;
                }
            }
            if (flag) {
                break;
            }
            //end
            //def int a (value,::int) and/none
            //def string a (value::string) and/none
        } else if (isopr("print")) {
            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
            cout << out << " ";
            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
            bool flag = false;
            while (1) {
                string print_num_type;
                cin >> print_num_type;
                if (print_num_type == ":def") {
                    string def_print_name;
                    cin >> def_print_name;
                    if (!def.count(def_print_name)) {
                        retnum = DEF_NOT_DEFINE;
                        flag = true;
                        break;
                    } else if (deftype(def_print_name) == "int") {
                        SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
                        cout << int_value(def_print_name) << " ";
                        SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
                        //end
                    } else if (deftype(def_print_name) == "string") {
                        SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
                        cout << str_value(def_print_name) << " ";
                        SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
                        //end
                    } else if (deftype(def_print_name) == "double") {
                        SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
                        cout << double_value(def_print_name) << " ";
                        SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
                        //end
                    } else {
                        retnum = UNKNOW_ERROR;
                        flag = true;
                        break;
                    }
                } else if (print_num_type == ":str") {
                    string put_string;
                    cin >> put_string;

                    SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
                    cout << put_string << " ";
                    SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
                } else if (print_num_type == ":is") {
                    string is_typename;
                    cin >> is_typename;
                    if (is_typename == "value") {
                        string is_type_a, is_type_b, is_type_opr;
                        cin >> is_type_a >> is_type_opr >> is_type_b;
                        if (!def.count(is_type_a) || !def.count(is_type_b)) {
                            retnum = UNKNOW_ERROR;
                            flag = true;
                            break;
                        }
                        if (deftype(is_type_a) == "int" && deftype(is_type_a) == "int") {
                            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
                            cout << btstr(pd_is(int_value(is_type_a), int_value(is_type_b), is_type_opr)) << " ";
                            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
                        } else if (deftype(is_type_a) == "string" && deftype(is_type_a) == "string") {
                            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
                            cout << btstr(pd_is(str_value(is_type_a), str_value(is_type_b), is_type_opr)) << " ";
                            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
                        } else if (deftype(is_type_a) == "double" && deftype(is_type_a) == "double") {
                            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
                            cout << btstr(pd_is(double_value(is_type_a), double_value(is_type_b), is_type_opr)) << " ";
                            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
                        } else {
                            retnum = UNKNOW_ERROR;
                            flag = true;
                            break;
                        }
                    } else if (is_typename == "number") {
                        string is_type;
                        cin >> is_type;
                        if (is_type == "int") {
                            int number_a, number_b;
                            string number_opr;
                            cin >> number_a >> number_opr >> number_b;
                            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
                            cout << btstr(pd_is(number_a, number_b, number_opr)) << " ";
                            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);

                        } else if (is_type == "string") {
                            string number_a, number_b;
                            string number_opr;
                            cin >> number_a >> number_opr >> number_b;
                            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
                            cout << btstr(pd_is(number_a, number_b, number_opr)) << " ";
                            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
                        } else if (is_type == "double") {
                            double number_a, number_b;
                            string number_opr;
                            cin >> number_a >> number_opr >> number_b;
                            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
                            cout << btstr(pd_is(number_a, number_b, number_opr)) << " ";
                            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
                        } else {
                            retnum = 100;
                            flag = true;
                            break;
                        }
                    }
                } else {
                    retnum = 2;
                    break;
                }
                string __and;
                cin >> __and;
                if (__and == "none" || __and == ";") {
                    break;
                } else if (__and != "and" && __and != ",") {
                    retnum = 100;
                    flag = true;
                    break;
                }
            }
            cout << endl;
            if (flag) {
                break;
            }
        } else if (isopr("no_line") || isopr("//")) {
            string no__line;
            cin >> no__line;
        } else if (isopr("let")) {
            string let_a, let_b, let_opr;
            int __isret;
            cin >> let_a >> let_opr >> let_b;
            if (deftype(let_a) == "string" && deftype(let_b) == "int") {
                if (let_opr == "times") {
                    def[let_a].s *= int_value(let_b);
                } else if (let_opr == "divide") {
                    def[let_a].s /= int_value(let_b);
                } else {
                    retnum = LET_ERROR;
                    break;
                }
            }
            __isret = let(let_a, let_b, let_opr);
            if (__isret) {
                retnum = __isret;
                break;
            }
        } else if (isopr("stack")) {
            string name, stack_do;
            cin >> name >> stack_do;
            if (!def.count(name)) {
                retnum = UNKNOW_ERROR;
                break;
            }
            if (stack_do == "push") {
                if (def[name].type_sq == "int") {
                    int push_v;
                    cin >> push_v;
                    si_def[name].push(push_v);
                } else if (def[name].type_sq == "string") {
                    string push_v;
                    cin >> push_v;
                    ss_def[name].push(push_v);
                } else if (def[name].type_sq == "double") {
                    double push_v;
                    cin >> push_v;
                    sd_def[name].push(push_v);
                } else {
                    retnum = UNKNOW_ERROR;
                    break;
                }

            } else if (stack_do == "pop") {
                if (def[name].type_sq == "int") {
                    si_def[name].pop();
                } else if (def[name].type_sq == "string") {
                    ss_def[name].pop();
                } else if (def[name].type_sq == "double") {
                    sd_def[name].pop();
                } else {
                    retnum = 100;
                    break;
                }
            } else if (stack_do == "top") {
                if (def[name].type_sq == "int") {
                    SetConsoleColor(FOREGROUND_RED | FOREGROUND_GREEN);
                    cout << out << si_def[name].top() << endl;
                    SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
                } else if (def[name].type_sq == "string") {
                    SetConsoleColor(FOREGROUND_RED | FOREGROUND_GREEN);
                    cout << out << ss_def[name].top() << endl;
                    SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
                } else if (def[name].type_sq == "double") {
                    SetConsoleColor(FOREGROUND_RED | FOREGROUND_GREEN);
                    cout << out << sd_def[name].top() << endl;
                    SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
                } else {
                    retnum = UNKNOW_ERROR;
                    break;
                }
            } else {
                retnum = UNKNOW_ERROR;
                break;
            }
        } else if (isopr("queue")) {
            string name, queue_do;
            cin >> name >> queue_do;
            if (!qd_def.count(name) && !qi_def.count(name) && !qs_def.count(name)) {
                retnum = UNKNOW_ERROR;
                break;
            }
            if (queue_do == "push") {
                if (def[name].type_sq == "int") {
                    int push_v;
                    cin >> push_v;
                    qi_def[name].push(push_v);
                } else if (def[name].type_sq == "string") {
                    string push_v;
                    cin >> push_v;
                    qs_def[name].push(push_v);
                } else if (def[name].type_sq == "double") {
                    double push_v;
                    cin >> push_v;
                    qd_def[name].push(push_v);
                } else {
                    retnum = UNKNOW_ERROR;
                    break;
                }

            } else if (queue_do == "pop") {
                if (def[name].type_sq == "int") {
                    qi_def[name].pop();
                } else if (def[name].type_sq == "string") {
                    qs_def[name].pop();
                } else if (def[name].type_sq == "double") {
                    qd_def[name].pop();
                } else {
                    retnum = UNKNOW_ERROR;
                    break;
                }
            } else if (queue_do == "front") {
                if (def[name].type_sq == "int") {
                    SetConsoleColor(FOREGROUND_RED | FOREGROUND_GREEN);
                    cout << out << qi_def[name].front() << endl;
                    SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
                } else if (def[name].type_sq == "string") {
                    SetConsoleColor(FOREGROUND_RED | FOREGROUND_GREEN);
                    cout << out << qs_def[name].front() << endl;
                    SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
                } else if (def[name].type_sq == "double") {
                    SetConsoleColor(FOREGROUND_RED | FOREGROUND_GREEN);
                    cout << out << qd_def[name].front() << endl;
                    SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
                } else {
                    retnum = UNKNOW_ERROR;
                    break;
                }
            } else {
                retnum = UNKNOW_ERROR;
                break;
            }
        } else if (isopr("to")) {
            string a_type, a_name, dt;
            cin >> a_name >> a_type;
            if (!def.count(a_name)) {
                retnum = TO_ERROR;
                break;
            }
            dt = deftype(a_name);
            if (a_type != deftype(a_name)) {
                if (dt == "string") {
                    if (a_type == "int") {
                        int those_num = 0;
                        bool is_n = 1;
                        string thstr = str_value(a_name);
                        for (int i = 0; i < int(thstr.length()); i++) {
                            if (thstr[i] == '-') {
                                if (i == 0) {
                                    is_n = 0;
                                } else {
                                    retnum = TO_ERROR;
                                    break;
                                }
                            } else {
                                those_num = those_num * 10 + thstr[i] - 48;
                            }
                        }
                        def[a_name].d = (is_n) ? those_num : (-those_num);
                        def[a_name].s = "";
                        def[a_name].type = "int";
                    } else if (a_type == "double") {
                        double it = 0, those_num = 0, down = 0;
                        bool is_n = 1, flag = 0, kflag = false;
                        string thstr = str_value(a_name);
                        for (int i = 0; i < int(thstr.length()); i++) {
                            if (thstr[i] == '-') {
                                if (i == 0) {
                                    is_n = 0;
                                } else {
                                    kflag = true;
                                    retnum = TO_ERROR;
                                    break;
                                }
                            } else if (thstr[i] == '.') {
                                if (i == 0) {
                                    retnum = TO_ERROR;
                                    kflag = true;
                                    break;
                                } else {
                                    flag = true;
                                }
                            } else if (thstr[i] >= '0' && thstr[i] <= '9') {
                                if (flag) {
                                    down = down * 10.0 + thstr[i] - 48.0;
                                    it++;
                                } else {
                                    those_num = those_num * 10.0 + thstr[i] - 48.0;
                                }
                            } else {
                                retnum = TO_ERROR;
                                kflag = true;
                                break;
                            }
                        }
                        those_num += down / pow(10, it);
                        def[a_name].lf = (is_n) ? those_num : (-those_num);
                        if (kflag) {
                            break;
                        }
                    } else {
                        retnum = TO_ERROR;
                        break;
                    }
                } else if (dt == "double") {
                    if (a_type == "int") {
                        def[a_name].d = floor(int_value(a_name));
                        def[a_name].lf = 0;
                        def[a_name].type = "int";
                    } else if (a_type == "string") {
                        retnum = TO_ERROR;
                        break;
                    }
                } else if (dt == "int") {
                    if (a_type == "double") {
                        def[a_name].lf = double(int_value(a_name));
                        def[a_name].type = "double";
                    } else if (a_type == "string") {
                        string itstr = "";
                        int thisint = int_value(a_name);
                        while (thisint) {
                            itstr += char(thisint % 10 + '0');
                            thisint /= 10;
                        }
                        def[a_name].s = itstr;
                        def[a_name].type = "string";
                    } else {
                        retnum = TO_ERROR;
                        break;
                    }
                } else {
                    retnum = TO_ERROR;
                    break;
                }
            }
        } else if (isopr("type")) {
            string name;
            cin >> name;
            SetConsoleColor(FOREGROUND_RED | FOREGROUND_GREEN);
            cout << out << deftype(name) << endl;
            SetConsoleColor(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE);
        } else if (isopr("math")) {
            int r = math();
            if (r == -1) {
                break;
            }
        } else if (isopr("end")) {
            cout << endl;
            retnum = NONE_ERR;
            break;
        } else {
            retnum = OPR_NOT_TYPE;
            break;
        }
    }

    end_cnle(retnum);
    return 0;
}

用法

定义变量示例:

def int a 3 , b 4 ;
def int c 5 and d 6 none

,(3.0版) 和 and 代表两个定义之间的分隔符号,可以在一行语句中一起使用。\ ;(3.0版) 和 none 代表定义的结束符号,不可以在一行语句中一起使用。\ int代表整形\ string代表字符串\ double(5.0版)代表浮点形\ stack<type>(5.0版)type类型的栈\ stack<type>(5.0版)type类型的队列

输出示例:

no_line define
def int a 3 , b 4 ;

print :str a= , :def a , :str a>b: , :is value a > b ;
print :str a= and :def a and :str a>b: and :is value a bigger_than b none

no_line k注释\ print 输出

赋值计算语句示例(5.0)

def int a 3 , b 4 ;

let a += b
let a plus b