diff --git a/01_hello_world/README.md b/01_hello_world/README.md index f8f9231e5bd1e60b6f54afc9b459fcc90ecabd30..4a2c9c5ebf99cc76fe1dcda3292c7c12ed1ae6d5 100644 --- a/01_hello_world/README.md +++ b/01_hello_world/README.md @@ -8,8 +8,10 @@ your toolchain is installed correctly, this will build two programs: `hello_worl demo@linux:01_hello_world$ make gcc -Wall -O3 -o hello_world_c hello_world.c g++ -Wall -O3 -o hello_world_cpp hello_world.cpp + demo@linux:01_hello_world$ ./hello_world_c hello, world, I'm C + demo@linux:01_hello_world$ ./hello_world_cpp hello, world, I'm C++ ``` diff --git a/02_control_structures/README.md b/02_control_structures/README.md index 5fbe0ad28c9b9c5985597e39513d23172d6bfb8b..f737b035cacf363463339843cd43f546567c23ee 100644 --- a/02_control_structures/README.md +++ b/02_control_structures/README.md @@ -1,3 +1,35 @@ # Control Structures These examples demonstrate loops and functions. + +``` +demo@linux:02_control_structures$ make +gcc -Wall -O3 -o loops loops.c +gcc -Wall -O3 -o functions functions.c + +demo@linux:02_control_structures$ ./loops +while loop: 0 +while loop: 1 +while loop: 2 +while loop: 3 +while loop: 4 +for loop: 0 +for loop: 1 +for loop: 2 +for loop: 3 +for loop: 4 +another while loop: 0 +another while loop: 1 +another while loop: 2 +leaving the while loop +1 is odd +3 is odd +i is 42 + +demo@linux:02_control_structures$ ./functions +two is even +three is odd +four isn't prime +5! = 120 +6 choose 4 = 15 +```