From e34038189304c1d5bb039ef9b2afe25f78e389fd Mon Sep 17 00:00:00 2001 From: Peter Gerwinski <peter.gerwinski@hs-bochum.de> Date: Thu, 24 Jan 2019 13:50:28 +0100 Subject: [PATCH] =?UTF-8?q?Musterl=C3=B6sung=203.1.2019:=20Quelltext?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 20181203/loesung-1.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 20181203/loesung-1.c diff --git a/20181203/loesung-1.c b/20181203/loesung-1.c new file mode 100644 index 0000000..34fda0b --- /dev/null +++ b/20181203/loesung-1.c @@ -0,0 +1,28 @@ +#include <stdio.h> + +#include "aufgabe-1.xbm" + +int main (void) +{ + int line_bytes = (aufgabe_1_width + 7) / 8; + for (int i = 0; i < aufgabe_1_height; i++) + { + unsigned char *p = aufgabe_1_bits + i * line_bytes; + unsigned char mask = 0x01; + for (int j = 0; j < aufgabe_1_width; j++) + { + if (*p & mask) + printf ("*"); + else + printf (" "); + mask <<= 1; + if (!mask) + { + mask = 0x01; + p++; + } + } + printf ("\n"); + } + return 0; +} -- GitLab