diff --git a/.github/workflows/preview-build.yml b/.github/workflows/preview-build.yml index 010e73a..3994b6e 100644 --- a/.github/workflows/preview-build.yml +++ b/.github/workflows/preview-build.yml @@ -1,4 +1,4 @@ -name: MCT-PreviewBuild +name: Preview-Build on: push: @@ -7,42 +7,31 @@ on: branches: [ "Preview" ] jobs: - linux-pre: + linux: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: build-linux-pre - run: make - working-directory: src/Preview - - name: Build Preview MCT-Linux + - name: CMake build + run: | + cd ${{ github.workspace }} + ls + mkdir build + cd build + cmake --version + cmake ../ + echo "Done!" + shell: sh + - name: Make build + run: | + cd ${{ github.workspace }} + ls + cd build + make + echo "Done!" + shell: sh + - name: Upload exec file uses: actions/upload-artifact@v3.1.2 with: - name: MCT-Linux-Pre - path: src/Preview/MCT-Linux-Pre - - macos-pre: - runs-on: macos-latest - steps: - - uses: actions/checkout@v3 - - name: build-macos-pre - run: make - working-directory: src/Preview - - name: Build Preview MCT-Macos - uses: actions/upload-artifact@v3.1.2 - with: - name: MCT-Macos-Pre - path: src/Preview/MCT-Linux-Pre - - windows-pre: - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - name: build-windows-pre - run: g++ MCT-Windows-Pre.cpp -o MCT-Windows-Pre.exe - working-directory: src/Preview - - name: Build Preview MCT-Windows - uses: actions/upload-artifact@v3.1.2 - with: - name: MCT-Windows-Pre.exe - path: src/Preview/MCT-Windows-Pre + name: MCT-Pre + path: build/MCT diff --git a/.gitignore b/.gitignore index 1d74e21..141afa7 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -.vscode/ +.vscode +build + diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..c2098a2 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "linux-gcc-x64", + "includePath": [ + "${workspaceFolder}/**" + ], + "compilerPath": "/usr/bin/gcc", + "cStandard": "${default}", + "cppStandard": "${default}", + "intelliSenseMode": "linux-gcc-x64", + "compilerArgs": [ + "" + ] + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..5610a5d --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,24 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "C/C++ Runner: Debug Session", + "type": "cppdbg", + "request": "launch", + "args": [], + "stopAtEntry": false, + "externalConsole": false, + "cwd": "/home/fts427/Git/MathCentralTool/src", + "program": "/home/fts427/Git/MathCentralTool/src/build/Debug/outDebug", + "MIMode": "gdb", + "miDebuggerPath": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index b242572..d2e3661 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,59 @@ { - "githubPullRequests.ignoredPullRequestBranches": [ - "main" - ] + "C_Cpp_Runner.msvcBatchPath": "", + "C_Cpp_Runner.cCompilerPath": "gcc", + "C_Cpp_Runner.cppCompilerPath": "g++", + "C_Cpp_Runner.debuggerPath": "gdb", + "C_Cpp_Runner.cStandard": "", + "C_Cpp_Runner.cppStandard": "", + "C_Cpp_Runner.useMsvc": false, + "C_Cpp_Runner.warnings": [ + "-Wall", + "-Wextra", + "-Wpedantic", + "-Wshadow", + "-Wformat=2", + "-Wcast-align", + "-Wconversion", + "-Wsign-conversion", + "-Wnull-dereference" + ], + "C_Cpp_Runner.msvcWarnings": [ + "/W4", + "/permissive-", + "/w14242", + "/w14287", + "/w14296", + "/w14311", + "/w14826", + "/w44062", + "/w44242", + "/w14905", + "/w14906", + "/w14263", + "/w44265", + "/w14928" + ], + "C_Cpp_Runner.enableWarnings": true, + "C_Cpp_Runner.warningsAsError": false, + "C_Cpp_Runner.compilerArgs": [], + "C_Cpp_Runner.linkerArgs": [], + "C_Cpp_Runner.includePaths": [], + "C_Cpp_Runner.includeSearch": [ + "*", + "**/*" + ], + "C_Cpp_Runner.excludeSearch": [ + "**/build", + "**/build/**", + "**/.*", + "**/.*/**", + "**/.vscode", + "**/.vscode/**" + ], + "C_Cpp_Runner.useAddressSanitizer": false, + "C_Cpp_Runner.useUndefinedSanitizer": false, + "C_Cpp_Runner.useLeakSanitizer": false, + "C_Cpp_Runner.showCompilationTime": false, + "C_Cpp_Runner.useLinkTimeOptimization": false, + "C_Cpp_Runner.msvcSecureNoWarnings": false } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..104aa15 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,29 @@ +{ + "tasks": [ + { + "type": "cppbuild", + "label": "C/C++: gcc 生成活动文件", + "command": "/usr/bin/gcc", + "args": [ + "-fdiagnostics-color=always", + "-g", + "${file}", + "-o", + "${fileDirname}/${fileBasenameNoExtension}", + "" + ], + "options": { + "cwd": "${fileDirname}" + }, + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "detail": "调试器生成的任务。" + } + ], + "version": "2.0.0" +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..c9ccfe8 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.9) + +PROJECT(MCT) +INCLUDE_DIRECTORIES( +./src/include +) +AUX_SOURCE_DIRECTORY(src ./src) +ADD_EXECUTABLE(${PROJECT_NAME} ./src/main.cpp) diff --git a/README.md b/README.md index 0a7ad71..7693c5f 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,11 @@
- +

MathCentralTool

-[![Download](https://img.shields.io/github/downloads/QuantumLS-Studio/MathCentralTool/total?logo=github&label=Download&style=for-the-badge&color=44cc11)](https://github.com/QuantumLS-Studio/MathCentralTool/releases) [![Stars](https://img.shields.io/github/stars/QuantumLS-Studio/MathCentralTool?logo=github&label=Stars&style=for-the-badge)](https://github.com/QuantumLS-Studio/MathCentralTool/stargazers) [![License](https://img.shields.io/github/license/QuantumLS-Studio/MathCentralTool?logo=github&label=License&style=for-the-badge&color=ff7a35)](https://github.com/QuantumLS-Studio/MathCentralTool/blob/master/LICENSE) [![Issues](https://img.shields.io/github/issues/QuantumLS-Studio/MathCentralTool?logo=github&lable=issues&style=for-the-badge "Issues")](https://github.com/QuantumLS-Studio/MathCentralTool/issues) @@ -17,42 +16,27 @@ [![Stable](https://img.shields.io/github/actions/workflow/status/QuantumLS-Studio/MathCentralTool/stable-build.yml?label=Stable&style=for-the-badge "Stable")](https://github.com/QuantumLS-Studio/MathCentralTool/actions/workflows/stable-build.yml) [![Preview](https://img.shields.io/github/actions/workflow/status/QuantumLS-Studio/MathCentralTool/preview-build.yml?label=Preview&style=for-the-badge "Preview")](https://github.com/QuantumLS-Studio/MathCentralTool/actions/workflows/preview-build.yml) -![EMAIL](https://img.shields.io/badge/EMAIL-fts427%40outlook.com-4169E1?style=for-the-badge&logoColor=white) -
[🀄简体中文](/README_zh.md) | 🔠[English](/README.md) -## 📃Introduce -A terminal-based math gadget that doesn't seem to be of any use. +## 📃 Introduce -This program is free and open source, this source code can be used at will. We allow everyone to use the source code for enrichment, compilation, etc. But we don't take any responsibility for any problems! +A terminal-based math tool that runs on linux. -⚠note: This program is in the development stage and cannot be used for scientific precision calculations! If anything goes wrong, do so at your own risk! +This program is free and open source. We allow everyone to use the source code for enrichment, compilation, etc. But we don't take any responsibility for any problems! -## ❔How to use +⚠worn: This program is in developing and cannot be used for scientific precision calculations! If anything goes wrong, do so at your own risk! -Look for the version in GitAction that matches your device +## ❔ How to use -Or clone and compile by yourself, but the source code of Linux and Windows is not the same, this needs to be noted! +Look in the GitAction and choose you need. -📦Linux compilation environment requirements: make, gcc +Or clone and compile by yourself. -### 🐧Linux +📦 Compilation environment requirements: cmake, make, gcc -Stable - -Please open the terminal under src/stable and run "make" to compile. - -Preview - -Please open the terminal under src/stable and run "make" to compile. - -### 💠Windows - -Compile the cpp file yourself using the compiler. - -## 🧑‍💻Contributing people +## 🧑‍💻 Contribution and thanks [FTS427](https://github.com/FTS427) responsible for the entire project @@ -62,6 +46,11 @@ Compile the cpp file yourself using the compiler. Thank every developer very much for their help!👍 -## 👀Othres things +## 👀 Other + +Change log [change](/change_log.md) + +This project also powered by [ECCPH](https://github.com/QuantumLS-Studio/ECCPH) + +Old versions[MathCentralTools](https://github.com/FTS427/MathCentralTools)(Archived🗃️) -See for older versions[MathCentralTools](https://github.com/FTS427/MathCentralTools)(Archived🗃️) diff --git a/README_zh.md b/README_zh.md index ab446ed..d43748a 100644 --- a/README_zh.md +++ b/README_zh.md @@ -6,7 +6,6 @@
-[![下载](https://img.shields.io/github/downloads/QuantumLS-Studio/MathCentralTool/total?logo=github&label=下载&style=for-the-badge&color=44cc11)](https://github.com/QuantumLS-Studio/MathCentralTool/releases) [![星标](https://img.shields.io/github/stars/QuantumLS-Studio/MathCentralTool?logo=github&label=星标&style=for-the-badge)](https://github.com/QuantumLS-Studio/MathCentralTool/stargazers) [![协议](https://img.shields.io/github/license/QuantumLS-Studio/MathCentralTool?logo=github&label=协议&style=for-the-badge&color=ff7a35)](https://github.com/QuantumLS-Studio/MathCentralTool/blob/master/LICENSE) [![议题](https://img.shields.io/github/issues/QuantumLS-Studio/MathCentralTool?logo=github&lable=议题&style=for-the-badge "议题")](https://github.com/QuantumLS-Studio/MathCentralTool/issues) @@ -17,17 +16,13 @@ [![Stable](https://img.shields.io/github/actions/workflow/status/QuantumLS-Studio/MathCentralTool/stable-build.yml?label=Stable&style=for-the-badge "Stable")](https://github.com/QuantumLS-Studio/MathCentralTool/actions/workflows/stable-build.yml) [![Preview](https://img.shields.io/github/actions/workflow/status/QuantumLS-Studio/MathCentralTool/preview-build.yml?label=Preview&style=for-the-badge "Preview")](https://github.com/QuantumLS-Studio/MathCentralTool/actions/workflows/preview-build.yml) -![C++](https://img.shields.io/badge/c++-4B0082?style=for-the-badge&logoColor=white) - -![邮箱](https://img.shields.io/badge/邮箱-fts427%40outlook.com-4169E1?style=for-the-badge&logoColor=white) -
[🀄简体中文](/README_zh.md) | [🔠English](/README.md) ## 📃介绍 -一个似乎没有什么用的基于终端的数学小工具。 +一个基于终端的数学小工具。 本程序是免费开源的,此源代码可以随意使用。允许任何人使用源代码进行扩充,编译等操作。出现任何问题,本人不承担任何责任! @@ -37,25 +32,11 @@ 在GitAction中寻找符合自己设备的版本 -或自行拉取编译,但Linux和Windows的源代码不一样,注意! - -📦编译环境需求(Linux):make,gcc - -### 🐧Linux - -Stable - -请在src/Stable下打开终端,执行“make“即可编译 +或自行拉取编译 -Preview +📦编译环境需求:cmake, make,gcc -请在src/Preview下打开终端,执行“make“即可编译 - -### 💠Windows - -自行使用编译器编译cpp文件 - -## 🧑‍💻贡献人员 +## 🧑‍💻感谢 [FTS427](https://github.com/FTS427)负责了整个项目 @@ -67,4 +48,9 @@ Preview ## 👀其他 +之前的更改?在[这里](/change_log.md) + +本项目使用了头文件[ECPPH](https://github.com/QuantumLS-Studio/ECPPH) + 先前的版本参见[MathCentralTools](https://github.com/FTS427/MathCentralTools)(已归档🗃️) + diff --git a/other/MCT.png b/assets/MCT.png similarity index 100% rename from other/MCT.png rename to assets/MCT.png diff --git a/Update.md b/change_log.md similarity index 94% rename from Update.md rename to change_log.md index e9e5d74..b1571df 100644 --- a/Update.md +++ b/change_log.md @@ -31,7 +31,7 @@ - UI:部分更改 - 整体:部分已知Bug修复,代码简化,引用了“ECPPH”头文件辅助开发 -##Preview +## Preview > 注:原有的“Insider”于2023年7月8日更名为“Preview” @@ -71,3 +71,7 @@ - 功能:未更新 - UI:大改界面 - 整体:引用了“ECPPH”头文件,整体代码逻辑修改,更便于维护 +- v0.0.1.3-3 + - 功能:移除对Windows、Mac平台的支持 + - UI:部分微调 + - 整体:简化代码逻辑,便于维护 diff --git a/make.sh b/make.sh new file mode 100755 index 0000000..98594e4 --- /dev/null +++ b/make.sh @@ -0,0 +1,5 @@ +cmake -S . -B ./build && +cd ./build && +make && +echo "Done!" && +echo "Exec -> build/MCT" diff --git a/src/Preview/linux/MCT-Linux-Pre b/src/Preview/linux/MCT-Linux-Pre deleted file mode 100755 index daad2fb..0000000 Binary files a/src/Preview/linux/MCT-Linux-Pre and /dev/null differ diff --git a/src/Preview/linux/MCT-Linux-Pre.cpp b/src/Preview/linux/MCT-Linux-Pre.cpp deleted file mode 100644 index 184b115..0000000 --- a/src/Preview/linux/MCT-Linux-Pre.cpp +++ /dev/null @@ -1,251 +0,0 @@ -//此版本为Preview测试版,有不稳定功能和不完整功能 - -#include "../head/ECPPH.h" -#include -char q; - -void hy(const char T[]){cout<<"欢迎使用"<> num1 >> o >> num2; - //加 - if (o == '+') - printf("%f+%f=%f\n",num1,num2,num1+num2); - //减 - if (o == '-') - printf("%f-%f=%f\n",num1,num2,num1-num2); - //乘 - if (o == '*') - printf("%f*%f=%f\n",num1,num2,num1*num2); - //除 - if (o == '/'){ - if (num2 != 0) - printf("%f/%f=%f\n",num1,num2,num1/num2); - else - error(); - } - //乘方 - /* - if (o == '^') { - int n=num2; - if(num1 != 0 && num2 != 0){ - num3 = 1; - while(n > 0) { - int(num1)*int(num3)=num3; - n--; - } - } - else - error(); - printf("%f^%f=%f\n",num1,num2,num3); - } - */ - //退出 - if(o == 'c' && num1 == 0 && num2 ==0){ - clear(); - break; - } - //报错 - else - error(); - } -} - -//B函数,计算最大公约数 -void B(){ - clear(); - double num3, num4; - hy("最大公约数"); - print("\033[1;43;37m注意\033[0m:本功能只支持两个数之间的运算!","no",true); - while(true){ - line("-",20,"yellow",true); - print("输入任意值继续,输入\033[33;1mC\033[0m退出...","no",true); - cin >> q; - if(q == 'c' || q == 'C'){ - clear(); - break; - } - else{ - print("请输入第一个数:","white",true); - cin >> num3; - print("请输入第二个数:","white",true); - cin >> num4; - num3 = abs(num3); - num4 = abs(num4); - while (num3 != num4){ - if (num3 > num4) - num3 -= num4; - else - num4 -= num3; - } - cout << "这两个数的的最大公约数是: " << num3 + num4 << endl; - } - } -} - -//C函数,计算最小公倍数 -void C(){ - clear(); - hy("最小公倍数"); - print("\033[1;43;37m注意\033[0m:本功能只支持两个数之间的运算!","no",true); - while(true){ - line("-",20,"yellow",true); - print("输入任意值继续,输入\033[33;1mC\033[0m退出...","no",true); - cin >> q; - if(q == 'c' || q == 'C'){ - clear(); - break; - } - else{ - int n3; - double num5, num6; - while (true){ - print("请输入第一个数:","white",true); - cin >> num5; - print("请输入第二个数:","white",true); - cin >> num6; - if (num5 != int(num5) || num6 != int(num6)) - error(); - else - break; - } - n3 = (num5 > num6) ? num5 : num6; - while (true){ - if (n3 % int(num5) == 0 && n3 % int(num6) == 0){ - cout << "这两个数的的最小公倍数是:" << n3 << endl; - break; - } - else - ++n3; - } - } - } -} - - -//D函数,数值分析器 -void D(){ - clear(); - long double x, a; - hy("数值分析器"); - while(true){ - line("-",20,"yellow",true); - print("输入任意值继续,输入\033[1;33mC\033[0m退出...","no",true); - cin >> q; - if (q == 'c' || q == 'C'){ - clear(); - break; - } - else{ - print("请输入一个数:","blue",true); - cin >> x; - if (x == 0){ - cout << x << "是整数" << endl; - cout << x << "是正数" << endl; - cout << x << "不分质数合数" << endl; - cout << x << "是偶数" << endl; - } - else{ - if (modf(x, &a) == 0.0) - cout << x << "是整数" << endl; - else - cout << x << "是分数" << endl; - if (x > 0) - cout << x << "是正数" << endl; - else - cout << x << "是负数" << endl; - if (x == 1) - cout << x << "不分质数合数" << endl; - if (int(x) - x != 0) - cout << x << "不分质数合数" << endl; - else{ - int n=0, i; - for(i=2;i0) - cout << x << "是合数" << endl; - cout << x << "是质数" << endl; - } - if (int(x) == x){ - if (int(x) % 2 == 0) - cout << x << "是偶数" << endl; - cout << x << "是奇数" << endl; - } - else{ - if (x/2 - int(x)/2 == 0) - cout << x << "是偶数" << endl; - cout << x << "是奇数" << endl; - } - } - } - } -} -/* -//E函数,几何计算 -void E(){ - hy("几何计算"); - while(true){ - line("-",20,"yellow",true); - print("输入任意键继续,输入“\033[1;33mc\033[0m”退出...","no",true); - cin >> q; - if (q == 'c' || q == 'C'){ - clear(); - break; - } - else{ - //矩形 梯形 三角形 圆 面积,周长,体积 - } - } -} -*/ -//主函数 -int main(){ - clear(); - hy("集成数学工具"); - char u; - while(true){ - line("-",20,"yellow",true); - dash("\033[1;34m(1)\033[34m计算器\033[0m"); - dash("\033[1;35m(2)\033[35m最大公约数\033[0m"); - dash("\033[1;36m(3)\033[36m最小公倍数\033[0m"); - dash("\033[1;32m(4)\033[32m数值分析器\033[0m"); - dash("\033[1;33m(5)\033[33m几何\033[0m"); - dash("\033[0m(a)关于\033[0m"); - dash("\033[1;33m(e)退出\033[0m"); - print("请键入所需功能:","white",false); - cin >> u; - if (u=='1') - calc(); - if (u=='2') - B(); - if (u=='3') - C(); - if (u=='4') - D(); -//if (u=='5')E(); - if (u=='E'||u=='e') - break; - if (u=='A'||u =='a'){ - clear(); - line("=",20,"blue",true); - dash("MCT Preview v0.0.1.3-2"); - dash("Made by QuantumLS-Studio"); - dash("Github:https://github.com/QuantumLS-Studio/MathCentralTool"); - line("=",20,"blue",true); - } - else - error(); - } - return 0; -} diff --git a/src/Preview/linux/Makefile b/src/Preview/linux/Makefile deleted file mode 100644 index 6e8aa9c..0000000 --- a/src/Preview/linux/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -MCT-Linux-Pre-Build: MCT-Linux-Pre.cpp - g++ MCT-Linux-Pre.cpp -o MCT-Linux-Pre diff --git a/src/Preview/win/MCT-Windows-Pre.cpp b/src/Preview/win/MCT-Windows-Pre.cpp deleted file mode 100644 index 4d8435f..0000000 --- a/src/Preview/win/MCT-Windows-Pre.cpp +++ /dev/null @@ -1,254 +0,0 @@ -//此版本为Preview测试版,有不稳定功能和不完整功能 - -#include "ECPPH.h" - -char q; - -void hy(const char T[]){cout<<"欢迎使用"<> num1 >> o >> num2; - //加 - if (o == '+') - cout << num1 << "+" << num2 << "=" << num1 + num2 << endl; - //减 - else if (o == '-') - cout << num1 << "-" << num2 << "=" << num1 - num2 << endl; - //乘 - else if (o == '*') - cout << num1 << "*" << num2 << "=" << num1 * num2 << endl; - //除 - else if (o == '/'){ - if (num2 == 0) - error(); - else - cout << num1 << "/" << num2 << "=" << num1/num2 << endl; - } - //乘方 - else if (o == '^') { - int n=num2; - if (num1 == 0 && num2 == 0) - error(); - else { - num3 = 1; - while (num2 > 0) { - num3 *= num1; - num2--; - } - } - cout << num1 << "^" << n << "=" << num3 << endl; - } - //退出 - else if(o == 'c' && num1 == 0 && num2 ==0){ - clear(1); - break; - } - //报错 - else - error(); - } -} - -//B函数,计算最大公约数 -void B(){ - clear(1); - double num3, num4; - hy("最大公约数"); - print("\033[1;43;37m注意\033[0m:本功能只支持两个数之间的运算!","no",true); - while(true){ - line("-",20,"yellow"); - print("输入任意值继续,输入\033[33;1mC\033[0m退出...","no",true); - cin >> q; - if(q == 'c' || q == 'C'){ - clear(1); - break; - } - else{ - print("请输入第一个数:","white",true); - cin >> num3; - print("请输入第二个数:","white",true); - cin >> num4; - num3 = abs(num3); - num4 = abs(num4); - while (num3 != num4){ - if (num3 > num4) - num3 -= num4; - else - num4 -= num3; - } - cout << "这两个数的的最大公约数是: " << num3 + num4 << endl; - } - } -} - -//C函数,计算最小公倍数 -void C(){ - clear(1); - hy("最小公倍数"); - print("\033[1;43;37m注意\033[0m:本功能只支持两个数之间的运算!","no",true); - while(true){ - line("-",20,"yellow"); - print("输入任意值继续,输入\033[33;1mC\033[0m退出...","no",true); - cin >> q; - if(q == 'c' || q == 'C'){ - clear(1); - break; - } - else{ - int n3; - double num5, num6; - while (true){ - print("请输入第一个数:","white",true); - cin >> num5; - print("请输入第二个数:","white",true); - cin >> num6; - if (num5 != int(num5) || num6 != int(num6)) - error(); - else - break; - } - n3 = (num5 > num6) ? num5 : num6; - while (true){ - if (n3 % int(num5) == 0 && n3 % int(num6) == 0){ - cout << "这两个数的的最小公倍数是:" << n3 << endl; - break; - } - else - ++n3; - } - } - } -} - - -//D函数,数值分析器 -void D(){ - clear(1); - long double x, a; - hy("数值分析器"); - while(true){ - line("-",20,"yellow"); - print("输入任意值继续,输入\033[1;33mC\033[0m退出...","no",true); - cin >> q; - if (q == 'c' || q == 'C'){ - clear(1); - break; - } - else{ - print("请输入一个数:","blue",true); - cin >> x; - if (x == 0){ - cout << x << "是整数" << endl; - cout << x << "是正数" << endl; - cout << x << "不分质数合数" << endl; - cout << x << "是偶数" << endl; - } - else{ - if (modf(x, &a) == 0.0) - cout << x << "是整数" << endl; - else - cout << x << "是分数" << endl; - if (x > 0) - cout << x << "是正数" << endl; - else - cout << x << "是负数" << endl; - if (x == 1) - cout << x << "不分质数合数" << endl; - else if (int(x) - x != 0) - cout << x << "不分质数合数" << endl; - else{ - int n=0, i; - for(i=2;i0) - cout << x << "是合数" << endl; - else - cout << x << "是质数" << endl; - } - if (int(x) == x){ - if (int(x) % 2 == 0) - cout << x << "是偶数" << endl; - else - cout << x << "是奇数" << endl; - } - else{ - if (x/2 - int(x)/2 == 0) - cout << x << "是偶数" << endl; - else - cout << x << "是奇数" << endl; - } - } - } - } -} - -//E函数,几何计算 -void E(){ - hy("几何计算"); - while(true){ - line("-",20,"yellow"); - print("输入任意键继续,输入“\033[1;33mc\033[0m”退出...","no",true); - cin >> q; - if (q == 'c' || q == 'C'){ - clear(1); - break; - } - else{ - //矩形 梯形 三角形 圆 面积,周长,体积 - } - } -} - -//主函数 -int main(){ - clear(1); - hy("集成数学工具"); - char u; - while(true){ - line("-",20,"yellow"); - dash("\033[1;34m(1)\033[34m计算器\033[0m"); - dash("\033[1;35m(2)\033[35m最大公约数\033[0m"); - dash("\033[1;36m(3)\033[36m最小公倍数\033[0m"); - dash("\033[1;32m(4)\033[32m数值分析器\033[0m"); - dash("\033[1;33m(5)\033[33m几何\033[0m"); - dash("\033[0m(a)关于\033[0m"); - dash("\033[1;33m(e)退出\033[0m"); - print("请键入所需功能:","white",false); - cin >> u; - if (u=='1') - calc(); - else if (u=='2') - B(); - else if (u=='3') - C(); - else if (u=='4') - D(); - else if (u=='5') - E(); - else if (u=='E'||u=='e') - break; - else if (u=='A'||u =='a'){ - clear(1); - line("=",20,"blue"); - dash("MCT Preview v0.0.1.2-4"); - dash("Made by QuantumLS-Studio"); - dash("Github:https://github.com/QuantumLS-Studio/MathCentralTool"); - line("=",20,"blue"); - } - else - error(); - } - return 0; -} diff --git a/src/Stable/ECPPH.h b/src/Stable/ECPPH.h deleted file mode 100644 index 9e61600..0000000 --- a/src/Stable/ECPPH.h +++ /dev/null @@ -1,93 +0,0 @@ -#include -#include -#include -#include -#include -#include -using namespace std; -//Easy C++ Head - -void error(){ - cout<<"\033[1,31mERROR!\033[0m\a\n"; -} - -void clear(int i){ - if(i==0) - system("clear"); - else if(i==1) - system("CLS"); - else - error(); -} - -void print(const char T[],string color,bool i){ - if(i==true){ - if(color=="no") - cout<1){ - print(S,color,false); - l--; - } - print(S,color,true); - } -} - -void dash(const char T[]){ - cout<<" - "<> num1 >> o >> num2; - //加 - if (o == '+') - cout << num1 << "+" << num2 << "=" << num1 + num2 << endl; - //减 - else if (o == '-') - cout << num1 << "-" << num2 << "=" << num1 - num2 << endl; - //乘 - else if (o == '*') - cout << num1 << "*" << num2 << "=" << num1 * num2 << endl; - //除 - else if (o == '/'){ - if (num2 == 0) - error(); - else - cout << num1 << "/" << num2 << "=" << num1/num2 << endl; - } - //乘方 - else if (o == '^') { - int n=num2; - if (num1 == 0 && num2 == 0) - error(); - else { - num3 = 1; - while (num2 > 0) { - num3 *= num1; - num2--; - } - } - cout << num1 << "^" << n << "=" << num3 << endl; - } - //退出 - else if(o == 'c' && num1 == 0 && num2 ==0){ - clear(0); - break; - } - //报错 - else - error(); - } -} - -//B函数,计算最大公约数 -void B(){ - clear(0); - double num3, num4; - hy("最大公约数"); - print("\033[1;43;37m注意\033[0m:本功能只支持两个数之间的运算!","no",true); - while(true){ - line("-",20,"yellow"); - print("输入任意值继续,输入\033[33;1mC\033[0m退出...","no",true); - cin >> q; - if(q == 'c' || q == 'C'){ - clear(0); - break; - } - else{ - print("请输入第一个数:","white",true); - cin >> num3; - print("请输入第二个数:","white",true); - cin >> num4; - num3 = abs(num3); - num4 = abs(num4); - while (num3 != num4){ - if (num3 > num4) - num3 -= num4; - else - num4 -= num3; - } - cout << "这两个数的的最大公约数是: " << num3 + num4 << endl; - } - } -} - -//C函数,计算最小公倍数 -void C(){ - clear(0); - hy("最小公倍数"); - print("\033[1;43;37m注意\033[0m:本功能只支持两个数之间的运算!","no",true); - while(true){ - line("-",20,"yellow"); - print("输入任意值继续,输入\033[33;1mC\033[0m退出...","no",true); - cin >> q; - if(q == 'c' || q == 'C'){ - clear(0); - break; - } - else{ - int n3; - double num5, num6; - while (true){ - print("请输入第一个数:","white",true); - cin >> num5; - print("请输入第二个数:","white",true); - cin >> num6; - if (num5 != int(num5) || num6 != int(num6)) - error(); - else - break; - } - n3 = (num5 > num6) ? num5 : num6; - while (true){ - if (n3 % int(num5) == 0 && n3 % int(num6) == 0){ - cout << "这两个数的的最小公倍数是:" << n3 << endl; - break; - } - else - ++n3; - } - } - } -} - - -//D函数,数值分析器 -void D(){ - clear(0); - long double x, a; - hy("数值分析器"); - while(true){ - line("-",20,"yellow"); - print("输入任意值继续,输入\033[1;33mC\033[0m退出...","no",true); - cin >> q; - if (q == 'c' || q == 'C'){ - clear(0); - break; - } - else{ - print("请输入一个数:","blue",true); - cin >> x; - if (x == 0){ - cout << x << "是整数" << endl; - cout << x << "是正数" << endl; - cout << x << "不分质数合数" << endl; - cout << x << "是偶数" << endl; - } - else{ - if (modf(x, &a) == 0.0) - cout << x << "是整数" << endl; - else - cout << x << "是分数" << endl; - if (x > 0) - cout << x << "是正数" << endl; - else - cout << x << "是负数" << endl; - if (x == 1) - cout << x << "不分质数合数" << endl; - else if (int(x) - x != 0) - cout << x << "不分质数合数" << endl; - else{ - int n=0, i; - for(i=2;i0) - cout << x << "是合数" << endl; - else - cout << x << "是质数" << endl; - } - if (int(x) == x){ - if (int(x) % 2 == 0) - cout << x << "是偶数" << endl; - else - cout << x << "是奇数" << endl; - } - else{ - if (x/2 - int(x)/2 == 0) - cout << x << "是偶数" << endl; - else - cout << x << "是奇数" << endl; - } - } - } - } -} - -//主函数 -int main(){ - clear(0); - hy("集成数学工具"); - char u; - while(true){ - line("-",20,"yellow"); - dash("\033[1;34m(1)\033[34m计算器\033[0m"); - dash("\033[1;35m(2)\033[35m最大公约数\033[0m"); - dash("\033[1;36m(3)\033[36m最小公倍数\033[0m"); - dash("\033[1;32m(4)\033[32m数值分析器\033[0m"); - dash("\033[0m(a)关于\033[0m"); - dash("\033[1;33m(e)退出\033[0m"); - print("请键入所需功能:","white",false); - cin >> u; - if (u=='1') - calc(); - else if (u=='2') - B(); - else if (u=='3') - C(); - else if (u=='4') - D(); - else if (u=='E'||u=='e') - break; - else if (u=='A'||u =='a'){ - clear(0); - line("=",20,"blue"); - dash("MCT Stable v0.0.1.2"); - dash("Made by QuantumLS-Studio"); - dash("Github:https://github.com/QuantumLS-Studio/MathCentralTool"); - line("=",20,"blue"); - } - else - error(); - } - return 0; -} diff --git a/src/Stable/MCT-Windows.cpp b/src/Stable/MCT-Windows.cpp deleted file mode 100644 index ae58832..0000000 --- a/src/Stable/MCT-Windows.cpp +++ /dev/null @@ -1,232 +0,0 @@ -#include "ECPPH.h" - -char q; - -void hy(const char T[]){cout<<"欢迎使用"<> num1 >> o >> num2; - //加 - if (o == '+') - cout << num1 << "+" << num2 << "=" << num1 + num2 << endl; - //减 - else if (o == '-') - cout << num1 << "-" << num2 << "=" << num1 - num2 << endl; - //乘 - else if (o == '*') - cout << num1 << "*" << num2 << "=" << num1 * num2 << endl; - //除 - else if (o == '/'){ - if (num2 == 0) - error(); - else - cout << num1 << "/" << num2 << "=" << num1/num2 << endl; - } - //乘方 - else if (o == '^') { - int n=num2; - if (num1 == 0 && num2 == 0) - error(); - else { - num3 = 1; - while (num2 > 0) { - num3 *= num1; - num2--; - } - } - cout << num1 << "^" << n << "=" << num3 << endl; - } - //退出 - else if(o == 'c' && num1 == 0 && num2 ==0){ - clear(1); - break; - } - //报错 - else - error(); - } -} - -//B函数,计算最大公约数 -void B(){ - clear(1); - double num3, num4; - hy("最大公约数"); - print("\033[1;43;37m注意\033[0m:本功能只支持两个数之间的运算!","no",true); - while(true){ - line("-",20,"yellow"); - print("输入任意值继续,输入\033[33;1mC\033[0m退出...","no",true); - cin >> q; - if(q == 'c' || q == 'C'){ - clear(1); - break; - } - else{ - print("请输入第一个数:","white",true); - cin >> num3; - print("请输入第二个数:","white",true); - cin >> num4; - num3 = abs(num3); - num4 = abs(num4); - while (num3 != num4){ - if (num3 > num4) - num3 -= num4; - else - num4 -= num3; - } - cout << "这两个数的的最大公约数是: " << num3 + num4 << endl; - } - } -} - -//C函数,计算最小公倍数 -void C(){ - clear(1); - hy("最小公倍数"); - print("\033[1;43;37m注意\033[0m:本功能只支持两个数之间的运算!","no",true); - while(true){ - line("-",20,"yellow"); - print("输入任意值继续,输入\033[33;1mC\033[0m退出...","no",true); - cin >> q; - if(q == 'c' || q == 'C'){ - clear(1); - break; - } - else{ - int n3; - double num5, num6; - while (true){ - print("请输入第一个数:","white",true); - cin >> num5; - print("请输入第二个数:","white",true); - cin >> num6; - if (num5 != int(num5) || num6 != int(num6)) - error(); - else - break; - } - n3 = (num5 > num6) ? num5 : num6; - while (true){ - if (n3 % int(num5) == 0 && n3 % int(num6) == 0){ - cout << "这两个数的的最小公倍数是:" << n3 << endl; - break; - } - else - ++n3; - } - } - } -} - - -//D函数,数值分析器 -void D(){ - clear(1); - long double x, a; - hy("数值分析器"); - while(true){ - line("-",20,"yellow"); - print("输入任意值继续,输入\033[1;33mC\033[0m退出...","no",true); - cin >> q; - if (q == 'c' || q == 'C'){ - clear(1); - break; - } - else{ - print("请输入一个数:","blue",true); - cin >> x; - if (x == 0){ - cout << x << "是整数" << endl; - cout << x << "是正数" << endl; - cout << x << "不分质数合数" << endl; - cout << x << "是偶数" << endl; - } - else{ - if (modf(x, &a) == 0.0) - cout << x << "是整数" << endl; - else - cout << x << "是分数" << endl; - if (x > 0) - cout << x << "是正数" << endl; - else - cout << x << "是负数" << endl; - if (x == 1) - cout << x << "不分质数合数" << endl; - else if (int(x) - x != 0) - cout << x << "不分质数合数" << endl; - else{ - int n=0, i; - for(i=2;i0) - cout << x << "是合数" << endl; - else - cout << x << "是质数" << endl; - } - if (int(x) == x){ - if (int(x) % 2 == 0) - cout << x << "是偶数" << endl; - else - cout << x << "是奇数" << endl; - } - else{ - if (x/2 - int(x)/2 == 0) - cout << x << "是偶数" << endl; - else - cout << x << "是奇数" << endl; - } - } - } - } -} - -//主函数 -int main(){ - clear(1); - hy("集成数学工具"); - char u; - while(true){ - line("-",20,"yellow"); - dash("\033[1;34m(1)\033[34m计算器\033[0m"); - dash("\033[1;35m(2)\033[35m最大公约数\033[0m"); - dash("\033[1;36m(3)\033[36m最小公倍数\033[0m"); - dash("\033[1;32m(4)\033[32m数值分析器\033[0m"); - dash("\033[0m(a)关于\033[0m"); - dash("\033[1;33m(e)退出\033[0m"); - print("请键入所需功能:","white",false); - cin >> u; - if (u=='1') - calc(); - else if (u=='2') - B(); - else if (u=='3') - C(); - else if (u=='4') - D(); - else if (u=='E'||u=='e') - break; - else if (u=='A'||u =='a'){ - clear(1); - line("=",20,"blue"); - dash("MCT Stable v0.0.1.2"); - dash("Made by QuantumLS-Studio"); - dash("Github:https://github.com/QuantumLS-Studio/MathCentralTool"); - line("=",20,"blue"); - } - else - error(); - } - return 0; -} diff --git a/src/Stable/Makefile b/src/Stable/Makefile deleted file mode 100644 index cac51b9..0000000 --- a/src/Stable/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -MCT-Linux-Build: MCT-Linux.cpp ECPPH.h - g++ MCT-Linux.cpp -o MCT-Linux diff --git a/src/Preview/head/ECPPH.h b/src/include/ecp.h similarity index 90% rename from src/Preview/head/ECPPH.h rename to src/include/ecp.h index 4d37c49..737efd7 100644 --- a/src/Preview/head/ECPPH.h +++ b/src/include/ecp.h @@ -1,25 +1,17 @@ #include #include #include -#include -#include -#include #include #include -#include #include -#include using namespace std; int error(){ - printf("\033[1,31mERROR!\033[0m\a\n"); + cout << "\033[1,31mERROR!\033[0m\a\n"; return 1; } -void clear(){ - printf("\033[2J"); - printf("\033[0,0"); -} +void clear(){system("clear");} void print(const char T[],string color,bool i){ if(i==true){ @@ -91,3 +83,5 @@ void boxout(const char T[],string bc,string tc,bool i){ } error; } +void hy(const char T[]){cout<<"==> "< ","white",false); + cin >> q; + if (q=='1') + calc(); + if (q=='2') + B(); + if (q=='3') + C(); + if (q=='4') + D(); +//if (u=='5')E(); + if (q=='E'||q=='e') + break; + if (q=='A'||q =='a'){ + clear(); + line("=",20,"blue",true); + dash("MCT Preview v0.0.1.3-4"); + dash("Made by QuantumLS-Studio"); + dash("Url: https://github.com/QuantumLS-Studio/MathCentralTool"); + line("=",20,"blue",true); + } + else{ + clear(); + error(); + } + } + return 0; +} diff --git a/src/plugins/calc.cpp b/src/plugins/calc.cpp new file mode 100644 index 0000000..92c9ea2 --- /dev/null +++ b/src/plugins/calc.cpp @@ -0,0 +1,53 @@ +//calc函数,计算器 +void calc(){ + clear(); + char o; + double num1,num2,num3; + hy("计算器"); + print("\033[1;37;43m[NOTE]\033[0m:现仅只支持两个数之间的运算!","no",true); + while (true){ + line("-",20,"yellow",true); + print("请输入计算式(+ - * / ^),输入'0c0'退出","white",true); + print("如: 1+1","white",true); + cin >> num1 >> o >> num2; + if (o == '+') + printf("%f+%f=%f\n",num1,num2,num1+num2); + //减 + if (o == '-') + printf("%f-%f=%f\n",num1,num2,num1-num2); + //乘 + if (o == '*') + printf("%f*%f=%f\n",num1,num2,num1*num2); + //除 + if (o == '/'){ + if (num2 != 0) + printf("%f/%f=%f\n",num1,num2,num1/num2); + else + error(); + } + //乘方 + /* +if (o == '^') { +int n=num2; +if(num1 != 0 && num2 != 0){ +num3 = 1; +while(n > 0) { +int(num1)*int(num3)=num3; +n--; +} +} +else +error(); +printf("%f^%f=%f\n",num1,num2,num3); +} +*/ + //退出 + if(o == 'c' && num1 == 0 && num2 ==0){ + clear(); + break; + } + //报错 + else + error(); + } +} diff --git a/src/plugins/cg.cpp b/src/plugins/cg.cpp new file mode 100644 index 0000000..bc56f82 --- /dev/null +++ b/src/plugins/cg.cpp @@ -0,0 +1,16 @@ +//E函数,几何计算 +void E(){ + hy("几何计算"); + while(true){ + line("-",20,"yellow",true); + print("输入任意键继续,输入“\033[1;33mc\033[0m”退出...","no",true); + cin >> q; + if (q == 'c' || q == 'C'){ + clear(); + break; + } + else{ + //矩形 梯形 三角形 圆 面积,周长,体积 + } + } +} \ No newline at end of file diff --git a/src/plugins/chn.cpp b/src/plugins/chn.cpp new file mode 100644 index 0000000..f74931b --- /dev/null +++ b/src/plugins/chn.cpp @@ -0,0 +1,58 @@ +//D函数,数值分析器 +void D(){ + clear(); + long double x, a; + hy("数值分析器"); + while(true){ + line("-",20,"yellow",true); + print("输入任意值继续,输入\033[1;33mC\033[0m退出...","no",true); + cin >> q; + if (q == 'c' || q == 'C'){ + clear(); + break; + } + else{ + print("请输入一个数:","blue",true); + cin >> x; + if (x == 0){ + cout << x << "是整数" << endl; + cout << x << "是正数" << endl; + cout << x << "不分质数合数" << endl; + cout << x << "是偶数" << endl; + } + else{ + if (modf(x, &a) == 0.0) + cout << x << "是整数" << endl; + else + cout << x << "是分数" << endl; + if (x > 0) + cout << x << "是正数" << endl; + else + cout << x << "是负数" << endl; + if (x == 1) + cout << x << "不分质数合数" << endl; + if (int(x) - x != 0) + cout << x << "不分质数合数" << endl; + else{ + int n=0, i; + for(i=2;i0) + cout << x << "是合数" << endl; + cout << x << "是质数" << endl; + } + if (int(x) == x){ + if (int(x) % 2 == 0) + cout << x << "是偶数" << endl; + cout << x << "是奇数" << endl; + } + else{ + if (x/2 - int(x)/2 == 0) + cout << x << "是偶数" << endl; + cout << x << "是奇数" << endl; + } + } + } + } +} \ No newline at end of file diff --git a/src/plugins/maxn.cpp b/src/plugins/maxn.cpp new file mode 100644 index 0000000..135890f --- /dev/null +++ b/src/plugins/maxn.cpp @@ -0,0 +1,31 @@ +//B函数,计算最大公约数 +void B(){ + clear(); + double num3, num4; + hy("最大公约数"); + print("\033[1;43;37m[NOTE]\033[0m:本功能只支持两个数之间的运算!","no",true); + while(true){ + line("-",20,"yellow",true); + print("输入任意值继续,输入\033[33;1mC\033[0m退出","no",true); + cin >> q; + if(q == 'c' || q == 'C'){ + clear(); + break; + } + else{ + print("请输入第一个数:","white",true); + cin >> num3; + print("请输入第二个数:","white",true); + cin >> num4; + num3 = abs(num3); + num4 = abs(num4); + while (num3 != num4){ + if (num3 > num4) + num3 -= num4; + else + num4 -= num3; + } + cout << "这两个数的的最大公约数是: " << num3 + num4 << endl; + } + } +} \ No newline at end of file diff --git a/src/plugins/minn.cpp b/src/plugins/minn.cpp new file mode 100644 index 0000000..632891c --- /dev/null +++ b/src/plugins/minn.cpp @@ -0,0 +1,38 @@ +//C函数,计算最小公倍数 +void C(){ + clear(); + hy("最小公倍数"); + print("\033[1;43;37m注意\033[0m:本功能只支持两个数之间的运算!","no",true); + while(true){ + line("-",20,"yellow",true); + print("输入任意值继续,输入\033[33;1mC\033[0m退出...","no",true); + cin >> q; + if(q == 'c' || q == 'C'){ + clear(); + break; + } + else{ + int n3; + double num5, num6; + while (true){ + print("请输入第一个数:","white",true); + cin >> num5; + print("请输入第二个数:","white",true); + cin >> num6; + if (num5 != int(num5) || num6 != int(num6)) + error(); + else + break; + } + n3 = (num5 > num6) ? num5 : num6; + while (true){ + if (n3 % int(num5) == 0 && n3 % int(num6) == 0){ + cout << "这两个数的的最小公倍数是:" << n3 << endl; + break; + } + else + ++n3; + } + } + } +}