summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-07-22 11:06:01 -0600
committermo khan <mo.khan@gmail.com>2020-07-22 11:06:01 -0600
commit976a848640034f19fc4203f02928c2be734aafb1 (patch)
tree99c3713bb768c6b1aaa11be9c6a25b346c8d7c3d
parent67bc0208e95a61c92977031cd873c6e5ecf71b9e (diff)
Episode 3: Lie Detector Tests
-rw-r--r--README.md54
-rw-r--r--main.c31
2 files changed, 64 insertions, 21 deletions
diff --git a/README.md b/README.md
index 6fe421d..5a4e8ec 100644
--- a/README.md
+++ b/README.md
@@ -92,3 +92,57 @@ rinse and repeat
printf("true\n");
}
```
+
+# conditions and logic
+
+
+
+
+# polygraphs
+
+* lie detector
+
+
+question:
+
+Q: Are you 36 years old?
+A: no
+
+* FAIL: this is not the truth
+ * the exam is over
+
+Q: Are you a male?
+A: yes
+
+* PASS: this is the truth
+ * continue to ask the next question
+
+* true | false
+* yes | no
+
+
+
+Truth tables
+
+* true: 1
+* false: 0
+
+AND
+
+| - | - | ------ |
+| x | y | result |
+| - | - | ------ |
+| 0 | 0 | 0 |
+| 0 | 1 | 0 |
+| 1 | 0 | 0 |
+| 1 | 1 | 1 |
+
+OR
+
+| - | - | ------ |
+| x | y | result |
+| - | - | ------ |
+| 0 | 0 | 0 |
+| 0 | 1 | 1 |
+| 1 | 0 | 1 |
+| 1 | 1 | 1 |
diff --git a/main.c b/main.c
index 867efd6..ad5174c 100644
--- a/main.c
+++ b/main.c
@@ -1,33 +1,22 @@
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
int main(int argc, char *argv[])
{
- char bike_rack[8];
- for (int i = 0; i < 8; i = i + 1)
+ // AND &&
+ // OR ||
+ //
+ int age = 30;
+
+ if (/* */)
{
- bike_rack[i] = '\0'; // NULL -> nothing
+ printf("Fly to Hawaii\n");
}
-
- // rack: [0, 1, 2, 3]
- // mo: 'm'
- // om: 'o'
- // bo: 'b'
- // yo: 'y'
-
- bike_rack[0] = 'm';
- /*bike_rack[1] = 'o';*/
- /*bike_rack[2] = 'b';*/
- bike_rack[3] = 'y';
-
- for (int i = 0; i < 8; i = i + 1)
+ else
{
- int bike = bike_rack[i];
- printf("bike rack slot %d: %c\n", i, bike);
+ printf("Camp in the back yard\n");
}
-
- printf("\n");
- return 0;
}
// 1. compile: c -> machine