builtin.cpp

来自「一个在linux下的shell的计算器」· C++ 代码 · 共 73 行

CPP
73
字号
/* * * * */#include <iostream>#include "builtin.h"#include "calculator.h"using namespace std;//////void LoadBuiltin(ItemList & list){ list.Add(new Operation(EXIT, "exit", 0)); list.Add(new Operation(BRACE, "{", 0)); list.Add(new Operation(UNBRACE, "}", 0)); list.Add(new Operation(SCI, "sci", 0)); list.Add(new Operation(FIX, "fix", 0)); list.Add(new Operation(DEC, "dec", 0)); list.Add(new Operation(HEX, "hex", 0)); list.Add(new Operation(OCT, "oct", 0)); list.Add(new Operation(HELP, "help", 0)); list.Add(new Operation(CLR, "clear", 0)); list.Add(new Operation(RCL, "rcl", 1)); list.Add(new Operation(DIG, "digits", 1)); list.Add(new Operation(DROP, "drop", 1)); list.Add(new Operation(DUP, "dup", 1)); list.Add(new Operation(STO, "sto", 2)); list.Add(new Operation(SWAP, "swap", 2)); // Alias list.Add(new Operation(EXIT, "quit", 0)); list.Add(new Operation(EXIT, "q", 0)); list.Add(new Operation(HELP, "?", 0)); list.Add(new Operation(SWAP, "%", 2)); list.Add(new Operation(DROP, ".", 1)); list.Add(new Operation(DUP, "=", 1)); list.Add(new Operation(CLR, "@", 0)); list.Add(new Operation(DIG, "dig", 1));}//////void StackHelp(){ cout << endl << "Stack operations: " << endl << endl; cout << "  clear    Clears the stack." << endl; cout << "  dup      Duplicates the first element in the stack." << endl; cout << "  drop     Deletes the first element in the stack." << endl; cout << "  swap     Swaps the first and second elements in the stack." << endl;}//////void FormatHelp(){ cout << endl << "Format operations: " << endl << endl; cout << "  sci      Use scientific notation." << endl; cout << "  fix      Use fixed notation." << endl; cout << "  dig      Set number of decimal digits." << endl; cout << "  dec      Display integers using decimal base." << endl; cout << "  hex      Display integers using hexadecimal base." << endl; cout << "  oct      Display integers using octal base." << endl;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?