diff --git a/.github/workflows/stable-build.yml b/.github/workflows/stable-build.yml index 3736fbc..d463c8b 100644 --- a/.github/workflows/stable-build.yml +++ b/.github/workflows/stable-build.yml @@ -1,4 +1,4 @@ -name: MCT-StableBuild +name: Stable-Build on: push: @@ -7,29 +7,31 @@ on: branches: [ "Stable" ] jobs: - linux: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: build-linux - run: make - working-directory: src - - name: Build MCT-Linux - uses: actions/upload-artifact@v3.1.2 - with: - name: MCT-Linux - path: src/MCT-Linux - - windows: - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - name: build-windows - run: g++ MCT-Windows.cpp -o MCT-Windows.exe - working-directory: src - - name: Build MCT-Windows + - 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-Windows - path: src/MCT-Windows + name: MCT-Stable + path: build/MCT + diff --git a/src/ECPPH.h b/src/ECPPH.h deleted file mode 100644 index 9e61600..0000000 --- a/src/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/MCT-Windows.cpp b/src/MCT-Windows.cpp deleted file mode 100644 index ae58832..0000000 --- a/src/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/Makefile b/src/Makefile deleted file mode 100644 index cac51b9..0000000 --- a/src/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/main.cpp b/src/main.cpp index 6b31a63..01fcf87 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,4 @@ -//Preview, be careful - -#include "./include/ecp.h" +#include "./include/ecp.h" #include "./plugins/calc.cpp" #include "./plugins/maxn.cpp" #include "./plugins/minn.cpp" @@ -17,7 +15,6 @@ int main(){ 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); @@ -30,13 +27,12 @@ int main(){ 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("MCT Stable v0.0.1.3"); dash("Made by QuantumLS-Studio"); dash("Url: https://github.com/QuantumLS-Studio/MathCentralTool"); line("=",20,"blue",true);