Skip to content

Commit 7f69b1e

Browse files
author
MayuriNFC
committed
new file: .vscode/launch.json
new file: .vscode/tasks.json modified: src/bubble.c new file: src/bubblesort.code-workspace
1 parent 54c591f commit 7f69b1e

File tree

4 files changed

+80
-2
lines changed

4 files changed

+80
-2
lines changed

c/bubblesort/.vscode/launch.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
// 使用 IntelliSense 了解相关属性。
3+
// 悬停以查看现有属性的描述。
4+
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "(gdb) 启动",
9+
"type": "cppdbg",
10+
"request": "launch",
11+
"program": "${workspaceFolder}/build/bubblesort.exe",
12+
"args": [],
13+
"stopAtEntry": false,
14+
"cwd": "${fileDirname}",
15+
"environment": [],
16+
"externalConsole": false,
17+
"MIMode": "gdb",
18+
"miDebuggerPath": "C:/Users/beaut/scoop/shims/gdb.exe",
19+
"setupCommands": [
20+
{
21+
"description": "为 gdb 启用整齐打印",
22+
"text": "-enable-pretty-printing",
23+
"ignoreFailures": true
24+
},
25+
{
26+
"description": "将反汇编风格设置为 Intel",
27+
"text": "-gdb-set disassembly-flavor intel",
28+
"ignoreFailures": true
29+
}
30+
]
31+
}
32+
33+
]
34+
}

c/bubblesort/.vscode/tasks.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"tasks": [
3+
{
4+
"type": "cppbuild",
5+
"label": "C/C++: gcc.exe 生成活动文件",
6+
"command": "C:\\Users\\beaut\\scoop\\apps\\gcc\\current\\bin\\gcc.exe",
7+
"args": [
8+
"-fdiagnostics-color=always",
9+
"-g",
10+
"${file}",
11+
"-o",
12+
"${fileDirname}\\${fileBasenameNoExtension}.exe"
13+
],
14+
"options": {
15+
"cwd": "${fileDirname}"
16+
},
17+
"problemMatcher": [
18+
"$gcc"
19+
],
20+
"group": {
21+
"kind": "build",
22+
"isDefault": true
23+
},
24+
"detail": "调试器生成的任务。"
25+
}
26+
],
27+
"version": "2.0.0"
28+
}

c/bubblesort/src/bubble.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
#include "../include/bubblesort.h"
22
int main()
33
{
4-
int a[] = {5, 3, 7, 9, 6, 8, 1, 4, 2, 10};
4+
int a[] = {5, 10, 3, 7, 9, 6, 8, 1, 4, 2};
55
int i;
66
int size = sizeof(a)/sizeof(a[0]);
7+
printf("Before sorting:\n");
8+
for (i = 0; i < size; i++)
9+
{
10+
printf("%d\n", a[i]);
11+
}
12+
bubblesort(a,size);
13+
printf("After sorting:\n");
714
for (i = 0; i < size; i++)
815
{
9-
bubblesort(a,10);
1016
printf("%d\n", a[i]);
1117
}
1218
return 0;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"folders": [
3+
{
4+
"path": ".."
5+
}
6+
],
7+
"settings": {
8+
"cmake.generator": "MinGW Makefiles",
9+
}
10+
}

0 commit comments

Comments
 (0)