Compare commits
2 Commits
76d836691b
...
ec366013bb
Author | SHA1 | Date | |
---|---|---|---|
ec366013bb | |||
fddf7ab780 |
@ -72,14 +72,14 @@ int main(int argc, char *argv[])
|
|||||||
rewind(file);
|
rewind(file);
|
||||||
|
|
||||||
for (uint i = 0; i < lines; i++) {
|
for (uint i = 0; i < lines; i++) {
|
||||||
char *buffer = NULL;
|
|
||||||
size_t bufferSize = 0;
|
|
||||||
if (getline(&buffer, &bufferSize, file) == -1)
|
if (getline(&buffer, &bufferSize, file) == -1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
sscanf(buffer, "%d %d", &array1[i], &array2[i]);
|
sscanf(buffer, "%d %d", &array1[i], &array2[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(buffer);
|
||||||
|
bufferSize = 0;
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
qsort(array1, lines, sizeof(int), compareInt);
|
qsort(array1, lines, sizeof(int), compareInt);
|
||||||
|
38
C_Template/.vscode/launch.json
vendored
Normal file
38
C_Template/.vscode/launch.json
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Launch with puzzle input",
|
||||||
|
"type": "cppdbg",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/build/CTemplate",
|
||||||
|
"args": ["../puzzle.input"],
|
||||||
|
"stopAtEntry": true,
|
||||||
|
"cwd": "${workspaceFolder}/build/",
|
||||||
|
"setupCommands": [
|
||||||
|
{
|
||||||
|
"description": "Enable pretty-printing for gdb",
|
||||||
|
"text": "-enable-pretty-printing",
|
||||||
|
"ignoreFailures": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"preLaunchTask": "build",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Launch with test input",
|
||||||
|
"type": "cppdbg",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/build/CTemplate",
|
||||||
|
"args": ["../test.input"],
|
||||||
|
"stopAtEntry": true,
|
||||||
|
"cwd": "${workspaceFolder}/build/",
|
||||||
|
"setupCommands": [
|
||||||
|
{
|
||||||
|
"description": "Enable pretty-printing for gdb",
|
||||||
|
"text": "-enable-pretty-printing",
|
||||||
|
"ignoreFailures": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"preLaunchTask": "build",
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
26
C_Template/.vscode/tasks.json
vendored
Normal file
26
C_Template/.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "cmake",
|
||||||
|
"type": "shell",
|
||||||
|
"options": {
|
||||||
|
"cwd": "${workspaceFolder}"
|
||||||
|
},
|
||||||
|
"command": "sh",
|
||||||
|
"args": [
|
||||||
|
"-c",
|
||||||
|
"'mkdir -p build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug ..'"
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "build",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "make",
|
||||||
|
"options": {
|
||||||
|
"cwd": "${workspaceRoot}/build"
|
||||||
|
},
|
||||||
|
"dependsOn":["cmake"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
0
C_Template/test.input
Normal file
0
C_Template/test.input
Normal file
Loading…
x
Reference in New Issue
Block a user