diff --git a/P04_Modularisieren_von_C_Code/work/modularize/bin/triangle b/P04_Modularisieren_von_C_Code/work/modularize/bin/triangle index fddacc5..d131374 100755 Binary files a/P04_Modularisieren_von_C_Code/work/modularize/bin/triangle and b/P04_Modularisieren_von_C_Code/work/modularize/bin/triangle differ diff --git a/P04_Modularisieren_von_C_Code/work/modularize/src/read.c b/P04_Modularisieren_von_C_Code/work/modularize/src/read.c index 17f07a6..05c2a20 100644 --- a/P04_Modularisieren_von_C_Code/work/modularize/src/read.c +++ b/P04_Modularisieren_von_C_Code/work/modularize/src/read.c @@ -12,6 +12,7 @@ * @brief Lab implementation */ // begin students to add code for task 4.1 +#include #define EOL 10 #define PARSE_ERROR -1 #define READ_ERROR -2 @@ -20,30 +21,13 @@ #define ASCII_DIGIT_9 57 #define NO_POS -1 #define BUFFERSIZE 10 -#define EOF -1 int getInt(int maxResult) { - // end of input - //int EOF = -1; // end of file - //int EOL = 10; // end of line - // abnormal return values - //int PARSE_ERROR = -1; - //int READ_ERROR = -2; - // ASCII Codes - //int ASCII_SPACE = 32; // ' ' - //int ASCII_DIGIT_0 = 48; // '0' - //int ASCII_DIGIT_9 = 57; // '9' - - // conversion buffer - //int NO_POS = -1; - //int BUFFERSIZE = 10; char buffer[BUFFERSIZE] = {0}; - int result = 0; // read line: up to EOL or EOF (i.e. error while reading) int bytes = 0; - int input; - scanf("%d", &input); + int input = getchar(); while ((input != EOL) && (input != EOF)) { // read whole line if (bytes < BUFFERSIZE) { // only buffer first n characters buffer[bytes] = (char)input; @@ -51,7 +35,7 @@ int getInt(int maxResult) { } else { result = PARSE_ERROR; // exceed buffer size, continue read line } - scanf("%d", &input); + input = getchar(); } if (input == EOF) { result = READ_ERROR; diff --git a/P04_Modularisieren_von_C_Code/work/modularize/src/read.d b/P04_Modularisieren_von_C_Code/work/modularize/src/read.d index bc19a4f..5c2ca14 100644 --- a/P04_Modularisieren_von_C_Code/work/modularize/src/read.d +++ b/P04_Modularisieren_von_C_Code/work/modularize/src/read.d @@ -1 +1,18 @@ -src/read.o: src/read.c /usr/include/stdc-predef.h +src/read.o: src/read.c /usr/include/stdc-predef.h /usr/include/stdio.h \ + /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \ + /usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/bits/long-double.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/types/__FILE.h \ + /usr/include/x86_64-linux-gnu/bits/types/FILE.h \ + /usr/include/x86_64-linux-gnu/bits/libio.h \ + /usr/include/x86_64-linux-gnu/bits/_G_config.h \ + /usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h \ + /usr/lib/gcc/x86_64-linux-gnu/7/include/stdarg.h \ + /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \ + /usr/include/x86_64-linux-gnu/bits/sys_errlist.h diff --git a/P04_Modularisieren_von_C_Code/work/modularize/src/read.o b/P04_Modularisieren_von_C_Code/work/modularize/src/read.o index ec055bf..77b6798 100644 Binary files a/P04_Modularisieren_von_C_Code/work/modularize/src/read.o and b/P04_Modularisieren_von_C_Code/work/modularize/src/read.o differ diff --git a/P04_Modularisieren_von_C_Code/work/modularize/tests/runtest b/P04_Modularisieren_von_C_Code/work/modularize/tests/runtest new file mode 100755 index 0000000..3e5869d Binary files /dev/null and b/P04_Modularisieren_von_C_Code/work/modularize/tests/runtest differ diff --git a/P04_Modularisieren_von_C_Code/work/modularize/tests/stderr.txt b/P04_Modularisieren_von_C_Code/work/modularize/tests/stderr.txt new file mode 100644 index 0000000..e69de29 diff --git a/P04_Modularisieren_von_C_Code/work/modularize/tests/stdout.txt b/P04_Modularisieren_von_C_Code/work/modularize/tests/stdout.txt new file mode 100644 index 0000000..8e874bc --- /dev/null +++ b/P04_Modularisieren_von_C_Code/work/modularize/tests/stdout.txt @@ -0,0 +1,8 @@ + +Dreiecksbestimmung (CTRL-C: Abbruch) +Seite a: Seite a: Seite a: Seite a: Seite a: Seite b: Seite b: Seite b: Seite b: Seite b: Seite c: Seite c: -> Dreieck 3-4-5 ist rechtwinklig + +Dreiecksbestimmung (CTRL-C: Abbruch) +Seite a: + +bye bye