Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
U | Preview Update (#22)
Browse files Browse the repository at this point in the history
* D | CI unsupport MacOS

* C | change some in CI

* M | Merge

* U | Update dir name

* U | Rewriting calc

* U | Update

* U | Update use

* U | Pair the function

* U | Update v0.0.1.3-4
U | Use ninja build source

* U | Update calc, error, etc.
  • Loading branch information
FTS427 authored Jan 14, 2024
1 parent 90bbba3 commit a66745e
Show file tree
Hide file tree
Showing 15 changed files with 79 additions and 96 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/preview-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ jobs:
cmake ../
echo "Done!"
shell: sh
- name: Make build
- name: Ninja build
run: |
cd ${{ github.workspace }}
ls
cd build
make
ninja
echo "Done!"
shell: sh
- name: Upload exec file
Expand Down
23 changes: 5 additions & 18 deletions .github/workflows/stable-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,22 @@ jobs:
- uses: actions/checkout@v3
- name: build-linux
run: make
working-directory: src/Stable
working-directory: src
- name: Build MCT-Linux
uses: actions/upload-artifact@v3.1.2
with:
name: MCT-Linux
path: src/Stable/MCT-Linux

macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: build-macos
run: make
working-directory: src/Stable
- name: Build MCT-Macos
uses: actions/upload-artifact@v3.1.2
with:
name: MCT-Macos
path: src/Stable/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/Stable
working-directory: src
- name: Build MCT-Windows
uses: actions/upload-artifact@v3.1.2
with:
name: MCT-Windows
path: src/Stable/MCT-Windows
path: src/MCT-Windows
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
.vscode
build

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ A terminal-based math tool that runs on linux.

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!

worn: This program is in developing and cannot be used for scientific precision calculations! If anything goes wrong, do so at your own risk!
Note: This program cannot be used for science! If anything goes wrong, do so at your own risk!

## ❔ How to use

Look in the GitAction and choose you need.
Look in the GitAction and choose waht you need.

Or clone and compile by yourself.

📦 Compilation environment requirements: cmake, make, gcc
📦 Compilation environment requirements: cmake, ninja, gcc

## 🧑‍💻 Contribution and thanks

Expand Down
5 changes: 2 additions & 3 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@

本程序是免费开源的,此源代码可以随意使用。允许任何人使用源代码进行扩充,编译等操作。出现任何问题,本人不承担任何责任!

⚠注意:本程序处于开发阶段,不可用于科学的精密计算!如果出现任何问题,后果自负!
注意:本程序处于开发阶段,不可用于科学的精密计算!如果出现任何问题,后果自负!

## ❔如何使用

在GitAction中寻找符合自己设备的版本

或自行拉取编译

📦编译环境需求:cmake, make,gcc
📦编译环境需求:cmake, ninja,gcc

## 🧑‍💻感谢

Expand All @@ -53,4 +53,3 @@
本项目使用了头文件[ECPPH](https://github.com/QuantumLS-Studio/ECPPH)

先前的版本参见[MathCentralTools](https://github.com/FTS427/MathCentralTools)(已归档🗃️)

4 changes: 4 additions & 0 deletions change_log.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,7 @@
- 功能:移除对Windows、Mac平台的支持
- UI:部分微调
- 整体:简化代码逻辑,便于维护
- v0.0.1.3-4
- 功能:无
- UI:部分调整
- 整体:代码部分重写,采用ninja&cmake编译
2 changes: 1 addition & 1 deletion make.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake -S . -B ./build &&
cd ./build &&
make &&
ninja &&
echo "Done!" &&
echo "Exec -> build/MCT"
22 changes: 15 additions & 7 deletions src/include/ecp.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
#include <cstring>
#include <cstdio>
#include <string>
#include <cstddef>
using namespace std;

int error(){
cout << "\033[1,31mERROR!\033[0m\a\n";
printf("\033[1,31mERROR!\033[0m\a\n");
return 1;
}

void clear(){system("clear");}
int clear(){
system("clear");
return 0;
}

void print(const char T[],string color,bool i){
if(i==true){
Expand All @@ -29,7 +33,8 @@ void print(const char T[],string color,bool i){
cout<<"\033[35m"<<T<<"\033[0m\n";
if(color=="white")
cout<<"\033[0m"<<T<<"\033[0m\n";
error;
else
error();
}
if(i==false){
if(color=="none")
Expand All @@ -48,9 +53,11 @@ void print(const char T[],string color,bool i){
cout<<"\033[35m"<<T<<"\033[0m";
if(color=="white")
cout<<"\033[0m"<<T<<"\033[0m";
error;
else
error();
}
error;
else
error();
}

void line(const char S[],int l,string color,bool i){
Expand All @@ -61,7 +68,7 @@ void line(const char S[],int l,string color,bool i){
}
print(S,color,i);
}
error;
error();
}

void dash(const char T[]){
Expand All @@ -81,7 +88,8 @@ void boxout(const char T[],string bc,string tc,bool i){
line("-",l+2,bc,false);
print("+",bc,i);
}
error;
else
error();
}
void hy(const char T[]){cout<<"==> "<<T<<endl;}
char q;
26 changes: 18 additions & 8 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
//Preview, be careful

#include "./include/ecp.h"
#include "./plugins/calc.cpp"
#include "./plugins/maxn.cpp"
#include "./plugins/minn.cpp"
#include "./plugins/chn.cpp"
#include "./plugins/cg.cpp"

// Include modules
#include "./module/calc.cpp"
#include "./module/maxn.cpp"
#include "./module/minn.cpp"
#include "./module/chn.cpp"
#include "./module/cg.cpp"

// Main function
int main(){
Expand All @@ -22,15 +24,23 @@ int main(){
dash("\033[1;33m(e)退出\033[0m");
print("> ","white",false);
cin >> q;
if (q=='1')
calc();
if (q=='1'){
int a,b;
char o;
print("calc> ","white",false);
cin >>a>>o>>b;
while (a!='0'&&b!='0'&&o!='c'){
cout << calc(a,b,o) <<endl;
print("calc> ","white",false);
cin >>a>>o>>b;
}
}
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'){
Expand Down
29 changes: 29 additions & 0 deletions src/module/calc.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <cstddef>
int calc(int fn, int bn, char o){
if (o=='+')
return fn+bn;
if (o=='-')
return fn-bn;
if (o=='*')
return fn*bn;
if (o=='/'){
if (fn==0)
error();
else
return fn/bn;
}
if (o=='^'){
if (fn==bn==0)
error();
int value=fn;
for (size_t i = 0; i <= bn; i++)
{
value=fn*value;
}
return value;
}
else{
error();
return 0;
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
53 changes: 0 additions & 53 deletions src/plugins/calc.cpp

This file was deleted.

0 comments on commit a66745e

Please sign in to comment.