commit aba255affada99e3156eb63149d77e2c2e68bf64 Author: Seth Date: Sun Dec 1 19:30:17 2024 +1300 still trying to read user input diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..9467abf --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,12 @@ +{ + "configurations": [ + { + "type": "cmake", + "request": "launch", + "name": "Debug portfile(s)", + "cmakeDebugType": "external", + "pipeName": "/tmp/vcpkg_ext_portfile_dbg", + "preLaunchTask": "Debug vcpkg commands" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..1b250ec --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "vcpkg.target.defaultTriplet": "x64-linux", + "vcpkg.target.hostTriplet": "x64-linux", + "vcpkg.target.useManifest": false, + "vcpkg.target.useStaticLib": false, + "cmake.configureArgs": [ + "-DVCPKG_MANIFEST_MODE=OFF", + "-DVCPKG_TARGET_TRIPLET=x64-linux" + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..08d9005 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,28 @@ +{ + "tasks": [ + { + "type": "cppbuild", + "label": "C/C++: gcc build active file", + "command": "/usr/bin/gcc", + "args": [ + "-fdiagnostics-color=always", + "-g", + "${file}", + "-o", + "${fileDirname}/${fileBasenameNoExtension}" + ], + "options": { + "cwd": "${fileDirname}" + }, + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "detail": "Task generated by Debugger." + } + ], + "version": "2.0.0" +} \ No newline at end of file diff --git a/puzzle1 b/puzzle1 new file mode 100755 index 0000000..46921dc Binary files /dev/null and b/puzzle1 differ diff --git a/puzzle1.c b/puzzle1.c new file mode 100644 index 0000000..9ac25bd --- /dev/null +++ b/puzzle1.c @@ -0,0 +1,43 @@ +#include +#include +#include +#define stringSize 20 + +int listSize = 0; +char readChar = '0'; +char stringOne[stringSize]; +char stringTwo[stringSize]; + +int readIntoList(char* stringList){ + int index = 0; + + while (getchar()=='\n'){ + //eat up new lines in buffer + } + + while (1) { + readChar = getchar(); + stringList[index] = readChar; + if (readChar == '\n' || index == stringSize-1) { + break; + } + index++; + } +} + +int main(){ + printf("enter list size: \n"); + + scanf("%i", &listSize); + int listOne[listSize]; + int listTwo[listSize]; + + memset (listOne, '\0', listSize); + memset (listTwo, '\0', listSize); + printf ("enter list 1: \n"); + readIntoList (stringOne); + printf ("enter list 2: \n"); + readIntoList (stringTwo); + + printf ("one: %s \ntwo: %s ",stringOne,stringTwo); +} \ No newline at end of file