Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
25
Task/Logical-operations/Bc/logical-operations-1.bc
Normal file
25
Task/Logical-operations/Bc/logical-operations-1.bc
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/* The following three functions assume 0 is false and 1 is true */
|
||||
|
||||
/* And */
|
||||
define a(x, y) {
|
||||
return(x * y)
|
||||
}
|
||||
|
||||
/* Or */
|
||||
define o(x, y) {
|
||||
return(x + y - x * y)
|
||||
}
|
||||
|
||||
/* Not */
|
||||
define n(x) {
|
||||
return(1 - x)
|
||||
}
|
||||
|
||||
define f(a, b) {
|
||||
"a and b: "
|
||||
a(a, b)
|
||||
"a or b: "
|
||||
o(a, b)
|
||||
"not a: "
|
||||
n(a)
|
||||
}
|
||||
5
Task/Logical-operations/Bc/logical-operations-2.bc
Normal file
5
Task/Logical-operations/Bc/logical-operations-2.bc
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
define logic_test(a, b) {
|
||||
print "a and b: ", a && b, "\n"
|
||||
print "a or b: ", a || b, "\n"
|
||||
print "not a: ", !a, "\n"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue