diff --git a/.gitignore b/.gitignore index f74e040..ed20416 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ # 排除IDE配置文件 .idea/ -.vscode/ .vs/ # 排除Trae AI配置文件 diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..14f75ea --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,27 @@ +{ + "configurations": [ + { + "name": "windows-gcc-x64", + "includePath": [ + "${workspaceFolder}/**" + ], + "defines": [ + "_DEBUG", + "UNICODE", + "_UNICODE" + ], + "compilerPath": "D:/Program Files/mingw64/bin/gcc.exe", + "cStandard": "c17", + "cppStandard": "c++17", + "intelliSenseMode": "windows-gcc-x64", + "compilerArgs": [ + "-Wall", + "-Wextra", + "-Wshadow", + "-fsanitize=address", + "-g3" + ] + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..07fbd99 --- /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": true, + "cwd": "d:/Code/C_code/.trae/rules", + "program": "d:/Code/C_code/.trae/rules/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 new file mode 100644 index 0000000..f3fceb5 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,73 @@ +{ + "C_Cpp_Runner.cCompilerPath": "gcc", + "C_Cpp_Runner.cppCompilerPath": "g++", + "C_Cpp_Runner.debuggerPath": "gdb", + "C_Cpp_Runner.cStandard": "c17", + "C_Cpp_Runner.cppStandard": "c++17", + "C_Cpp_Runner.msvcBatchPath": "", + "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, + "files.associations": { + "*.gbk": "cpp", + "stdlib.h": "c", + "game_mode.h": "c", + "windows.h": "c", + "stdio.h": "c", + "stat.h": "c", + "init_board.h": "c", + "init.h": "c", + "record.h": "c", + "ai.h": "c", + "string.h": "c", + "direct.h": "c" + } +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..8c7ab17 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,28 @@ +{ + "tasks": + [ + { + "type": "shell", + "label": "C/C++: gcc.exe 生成活动文件", + "command": "D:\\Program Files\\mingw64\\bin\\gcc.exe", + "args": + [ + "-fdiagnostics-color=always", + "-g", + "${file}", + "-o", + "${fileDirname}\\${fileBasenameNoExtension}.exe", + "-Wall", + "-Werror", + "-std=c++17", + "-fsanitize=address", + "-static-libasan" + ], + "options": {"cwd": "${fileDirname}"}, + "problemMatcher": ["$gcc"], + "group": {"kind": "build","isDefault": true}, + "detail": "调试器生成的任务。" + } + ], + "version": "2.0.0" +} \ No newline at end of file diff --git a/翁凯C语言/1/Hello.c b/翁凯C语言/1/位数.c similarity index 95% rename from 翁凯C语言/1/Hello.c rename to 翁凯C语言/1/位数.c index bd498d2..4edc381 100644 --- a/翁凯C语言/1/Hello.c +++ b/翁凯C语言/1/位数.c @@ -16,6 +16,4 @@ int main() } printf("%d\n",n); return 0; -} - - \ No newline at end of file +} \ No newline at end of file diff --git a/翁凯C语言/13/链表的清除.c b/翁凯C语言/13/链表的清除.c index af4f2da..5de46d6 100644 --- a/翁凯C语言/13/链表的清除.c +++ b/翁凯C语言/13/链表的清除.c @@ -9,9 +9,13 @@ #include #endif -// !链表 +// !链表的清除 /* - 1. + 1. 清除链表中的所有节点 + 2. 释放链表占用的内存 + 2.1 使用malloc申请的动态内存需要释放 + 2.2 用malloc申请的内存,即使没有赋值,也会被赋值一个特定的值 + 赋值就是使用,所以没必要为这种内存清空赋值 */ typedef struct _node{ diff --git a/草稿/test.md b/草稿/test.md deleted file mode 100644 index 76f61ba..0000000 --- a/草稿/test.md +++ /dev/null @@ -1,9 +0,0 @@ -# Ľ -ٴγɹȻѾûб⣬ҽԴһЩĽ飬Ϳάԡ -1. ȫֱ ʹȫֱ board , step_count ȣʹά״̬ĸıܷκεط˵Ѷȡ齫Щװһ GameState ṹУͨṹָ롣 -2. ṹ Ŀǰ gobang.h Ϸ߼AI߼ game_mode.h ϷģʽԿǽAIصĺ evaluate_pos , dfs , ai_move 뵽һµͷļ ai.h Уʹְ -3. ħ ʹһЩħ֡ handle_player_turn ʹ -1 , -2 , -3 Ϊıʶʹ enum #define ΪЩֶƣ INPUT_UNDO , INPUT_SAVE , INPUT_EXIT -4. 봦 handle_player_turn е봦߼ȽϸӣԿǽΪСĺһרڽûĺ -5. gobang.c еһЩܹرAIصĺǷֽΪСġܵһĺ߿ɶԡ -6. ļ save_game , load_game Ӹ׳Ĵ fopen ķֵʧʱûṩȷĴϢ -7. ע ȻһЩעͣԶԸӵ㷨AI evaluate_pos dfs Ӹϸעͣ乤ԭƾߡ \ No newline at end of file diff --git a/草稿/test.tex b/草稿/test.tex deleted file mode 100644 index f8312ab..0000000 Binary files a/草稿/test.tex and /dev/null differ diff --git a/草稿/草稿1.c b/草稿/草稿1.c deleted file mode 100644 index e69de29..0000000 diff --git a/草稿/草稿2.c b/草稿/草稿2.c deleted file mode 100644 index 681d151..0000000 --- a/草稿/草稿2.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -int main() -{ - long int n; - scanf("%ld", &n); - long m; - scanf("%ld", &m); - long long int a[n]; - long long b; - - return 0; -} \ No newline at end of file diff --git a/课上代码练习/1.1.1/初识C语言.c b/课上代码练习/1.1.1/初识C语言.c deleted file mode 100644 index 1e3562f..0000000 --- a/课上代码练习/1.1.1/初识C语言.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -int main() -{ - double a, b, c; - scanf("%lf %lf", &a, &b); - c = a / b; - printf("%.0f/%.0f=%.2f\n", a, b, c); - - return 0; diff --git a/课上代码练习/1.1.2/num_max.c b/课上代码练习/1.1.2/num_max.c deleted file mode 100644 index f7a2614..0000000 --- a/课上代码练习/1.1.2/num_max.c +++ /dev/null @@ -1,26 +0,0 @@ -#include - -int max(int a, int b); - -int main() -{ - int a, b,c; - scanf("%d %d", &a, &b); - - c = max(a, b); - - printf("%d%d%d", a, b, c); - - return 0; -} - -int max(int a, int b) -{ - int c = a; - - if (a - -int main() -{ - int sign = 1; - int n; - printf("n: "); - scanf("%d", &n); - double deno = 2.0, sum = 1.0, term; - - while (deno <= n) - { - sign = -sign; - term = sign / deno; - sum = sum + term; - deno = deno + 1; - } - printf("%f\n", sum); - - return 0; -} \ No newline at end of file diff --git a/课上代码练习/1.1.4/char函数.c b/课上代码练习/1.1.4/char函数.c deleted file mode 100644 index ba7b10b..0000000 --- a/课上代码练习/1.1.4/char函数.c +++ /dev/null @@ -1,20 +0,0 @@ -#include - -int main() -{ - char c = 'Y'; - putchar(66); // B - putchar('O'); // O - putchar(c); // Y - putchar('\n'); - - char a, b; - a = getchar(); - b = getchar(); - putchar(a); - putchar(b); - - putchar(getchar()); - - return 0; -} \ No newline at end of file diff --git a/课上代码练习/1.1.5/字母大小写转换.c b/课上代码练习/1.1.5/字母大小写转换.c deleted file mode 100644 index 53d6288..0000000 --- a/课上代码练习/1.1.5/字母大小写转换.c +++ /dev/null @@ -1,14 +0,0 @@ -#include - -int main() -{ - char c1, c2; - printf("һдĸ"); - c1 = getchar(); - c2 = c1 + 32; - printf("תСдĸΪ"); - putchar(c2); - putchar('\n'); - - return 0; -} \ No newline at end of file diff --git a/课上代码练习/1.1.6/if_else.c b/课上代码练习/1.1.6/if_else.c deleted file mode 100644 index a394330..0000000 --- a/课上代码练习/1.1.6/if_else.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -int main() -{ - int a, b, c; - a = b = c = 0; - a++ &&b++ | c++; - printf("%d,%d,%d\n",a,b,c); - return 0; -} \ No newline at end of file diff --git a/课上代码练习/1.1.7/BMI.c b/课上代码练习/1.1.7/BMI.c deleted file mode 100644 index d0b3cc1..0000000 --- a/课上代码练习/1.1.7/BMI.c +++ /dev/null @@ -1,26 +0,0 @@ -#include - -int main() -{ - double a, b,c; - printf("(kg)(cm)\n"); - scanf("%lf %lf",&a,&b); - - b /= 100; - c=a/(b*b); - - if(c< 18) - { - printf("BMI%.2f,̫\n",c); - } - else if (c > 24) - { - printf("BMI%.2f,е\n",c); - } - else if (18 <= c && c <= 24) - { - printf("BMI%.2f,\n",c); - } - - return 0; -} \ No newline at end of file