This repository has been archived by the owner on Aug 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from FTS427/Preview
U | PreviewUpdate
- Loading branch information
Showing
14 changed files
with
349 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
MCT-Build: main.cpp | ||
MCT-Build: main.cpp ./cpart/ | ||
g++ main.cpp -o ../bin/MCT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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{ | ||
//矩形 梯形 三角形 圆 面积,周长,体积 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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;i<x;i=i+1) | ||
if(int(x)%1 == 0) | ||
n=n+1; | ||
if (n >0) | ||
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; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.