From 63265d5cfb8962159eb383a9ae266fa739fb9b74 Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Tue, 12 Nov 2024 02:59:00 +0100 Subject: [PATCH] Bunch of ignores e.t.c. --- .gitignore | 1 + lab1/.gitignore | 2 ++ lab1/Justfile | 22 ++++++++++++++++++++-- lab1/buggy_programs/.gitignore | 6 ++++++ lab1/cmake-example/.gitignore | 1 + lab1/coding.cc | 18 +++++++++++------- 6 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 lab1/.gitignore create mode 100644 lab1/buggy_programs/.gitignore create mode 100644 lab1/cmake-example/.gitignore diff --git a/.gitignore b/.gitignore index 6142305..2458f1e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.o *.d +*a.out* diff --git a/lab1/.gitignore b/lab1/.gitignore new file mode 100644 index 0000000..6f6e224 --- /dev/null +++ b/lab1/.gitignore @@ -0,0 +1,2 @@ +hello +test_editor diff --git a/lab1/Justfile b/lab1/Justfile index 1ab8b38..09cf796 100644 --- a/lab1/Justfile +++ b/lab1/Justfile @@ -1,18 +1,36 @@ -all: a1 a2 a3 a4 +all: a1 a2 a3 a4 cmake buggy +# Build the A1 lab exercise a1: g++ -o hello hello.cc ./hello + +# Build the A2 lab exercise a2: g++ -std=c++11 -o separate_main separate_main.cc separate_fn.cc +# Build the A3 lab exercise a3: g++ -std=c++11 -c separate_main.cc g++ -std=c++11 -c separate_fn.cc g++ -std=c++11 -o separate_main separate_main.o separate_fn.o +# Build the A4 lab exercise a4: - g++ -std=c++11 -o separate_main separate_main.cc + @echo "Will fail" + -g++ -std=c++11 -o separate_main separate_main.cc +# Build the A5 lab exercise a5: g++ -c -O2 -Wall -Wextra -pedantic-errors -Wold-style-cast -std=c++11 hello.cc + +# Build the cmake exercise +cmake: + rm -rf ./cmake-example/build # Start over + cd ./cmake-example && mkdir -p build + cd ./cmake-example/build && cmake .. + cd ./cmake-example/build && make -j$(nproc) + ./cmake-example/build/SimpleMain + +buggy: + cd ./buggy_programs && make -j4 diff --git a/lab1/buggy_programs/.gitignore b/lab1/buggy_programs/.gitignore new file mode 100644 index 0000000..eb7d7dc --- /dev/null +++ b/lab1/buggy_programs/.gitignore @@ -0,0 +1,6 @@ +bounds +bounds-heap +dangling +leak +sum +ub diff --git a/lab1/cmake-example/.gitignore b/lab1/cmake-example/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/lab1/cmake-example/.gitignore @@ -0,0 +1 @@ +build diff --git a/lab1/coding.cc b/lab1/coding.cc index 6b28096..c06bb86 100644 --- a/lab1/coding.cc +++ b/lab1/coding.cc @@ -1,10 +1,14 @@ -#include +#include -unsigned char encode(unsigned char c) -{ - return c; +unsigned char encode(unsigned char c) { + if ((c >= 'A' && c <= 'Z')) + return ((c - 'A' + 13) % 26) + 'A'; + else if ((c >= 'a' && c <= 'z')) + return ((c - 'a' + 13) % 26) + 'a'; + else + return c; // Non-alphabetic characters are unchanged } -unsigned char decode(unsigned char c) -{ - return c; + +unsigned char decode(unsigned char c) { + return encode(c); // ROT13 encoding and decoding are the same }