From c98c0bdf5b3920795f28de691801f39246cff1a4 Mon Sep 17 00:00:00 2001 From: Erik Strand <erik.strand@cba.mit.edu> Date: Wed, 21 Oct 2020 00:52:19 -0400 Subject: [PATCH] Update READMEs --- 01_hello_world/README.md | 2 ++ 02_control_structures/README.md | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/01_hello_world/README.md b/01_hello_world/README.md index f8f9231..4a2c9c5 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 5fbe0ad..f737b03 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 +``` -- GitLab