September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
13
Task/Integer-comparison/ABAP/integer-comparison.abap
Normal file
13
Task/Integer-comparison/ABAP/integer-comparison.abap
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
report z_integer_comparison.
|
||||
|
||||
parameters: a type int4, b type int4.
|
||||
|
||||
data(comparison_result) = cond string(
|
||||
when a < b " can be replaced by a lt b
|
||||
then |{ a } is less than { b }|
|
||||
when a = b " can be replaced by a eq b
|
||||
then |{ a } is equal to { b }|
|
||||
when a > b " can be replaced by a gt b
|
||||
then |{ a } is greater than { b }| ).
|
||||
|
||||
write comparison_result.
|
||||
9
Task/Integer-comparison/BASIC/integer-comparison-4.basic
Normal file
9
Task/Integer-comparison/BASIC/integer-comparison-4.basic
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
100 INPUT PROMPT "Enter A: ":A
|
||||
110 INPUT PROMPT "Enter B: ":B
|
||||
120 IF A<B THEN
|
||||
130 PRINT A;"is lesss than ";B
|
||||
140 ELSE IF A=B THEN
|
||||
150 PRINT A;"is equal to ";B
|
||||
160 ELSE
|
||||
170 PRINT A;"is greater than ";B
|
||||
180 END IF
|
||||
10
Task/Integer-comparison/BASIC/integer-comparison-5.basic
Normal file
10
Task/Integer-comparison/BASIC/integer-comparison-5.basic
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
100 INPUT PROMPT "Enter A: ":A
|
||||
110 INPUT PROMPT "Enter B: ":B
|
||||
120 SELECT CASE A
|
||||
130 CASE IS<B
|
||||
140 PRINT A;"is lesss than ";B
|
||||
150 CASE IS=B
|
||||
160 PRINT A;"is equal to ";B
|
||||
170 CASE ELSE
|
||||
180 PRINT A;"is greater than ";B
|
||||
190 END SELECT
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
DISPLAY A " is equal to " B
|
||||
ELSE IF A > B
|
||||
DISPLAY A " is larger than " B
|
||||
END-IF
|
||||
END-IF.
|
||||
|
||||
GOBACK
|
||||
.
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
import extensions.
|
||||
import extensions;
|
||||
|
||||
program =
|
||||
[
|
||||
var a := console readLine; toInt.
|
||||
var b := console readLine; toInt.
|
||||
public program()
|
||||
{
|
||||
var a := console.readLine().toInt();
|
||||
var b := console.readLine().toInt();
|
||||
|
||||
if (a < b)
|
||||
[ console printLine(a," is less than ",b) ].
|
||||
{ console.printLine(a," is less than ",b) };
|
||||
|
||||
if (a == b)
|
||||
[ console printLine(a," equals ",b) ].
|
||||
{ console.printLine(a," equals ",b) };
|
||||
|
||||
if (a > b)
|
||||
[ console printLine(a," is greater than ",b) ].
|
||||
].
|
||||
{ console.printLine(a," is greater than ",b) }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
(defun integer-comparison (a b)
|
||||
"Compare A to B and print the outcome in the message buffer."
|
||||
(interactive "nFirst integer ⇒\nnSecond integer ⇒")
|
||||
(cond
|
||||
((< a b) (message "%d is less than %d." a b))
|
||||
((> a b) (message "%d is greater than %d." a b))
|
||||
((= a b) (message "%d is equal to %d." a b))))
|
||||
|
|
@ -0,0 +1 @@
|
|||
(integer-comparison 12 42)
|
||||
|
|
@ -1,5 +1,10 @@
|
|||
# let max a b =
|
||||
if a!= b then
|
||||
if a>b then Printf.printf "%d is greater than %d" a b else Printf.printf "%d is less than %d" a b
|
||||
else
|
||||
print_string "numbers are equal" ;;
|
||||
let my_compare a b =
|
||||
if a < b then "A is less than B"
|
||||
else if a > b then "A is greater than B"
|
||||
else if a = b then "A equals B"
|
||||
else "cannot compare NANs"
|
||||
|
||||
let () =
|
||||
let a = read_int ()
|
||||
and b = read_int () in
|
||||
print_endline (my_compare a b)
|
||||
|
|
|
|||
16
Task/Integer-comparison/Ol/integer-comparison.ol
Normal file
16
Task/Integer-comparison/Ol/integer-comparison.ol
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
(define (compare a b)
|
||||
(cond ((< a b) "A is less than B")
|
||||
((> a b) "A is greater than B")
|
||||
((= a b) "A equals B")))
|
||||
|
||||
(print (compare 1 2))
|
||||
; ==> A is less than B
|
||||
|
||||
(print (compare 2 2))
|
||||
; ==> A equals B
|
||||
|
||||
(print (compare 3 2))
|
||||
; ==> A is greater than B
|
||||
|
||||
; manual user input:
|
||||
(print (compare (read) (read)))
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
(prin "Please enter two values: ")
|
||||
|
||||
(in NIL # Read from standard input
|
||||
(let (A (read) B (read))
|
||||
(let (A (read) B (read))
|
||||
(prinl
|
||||
"The first one is "
|
||||
(cond
|
||||
|
|
|
|||
4
Task/Integer-comparison/Retro/integer-comparison.retro
Normal file
4
Task/Integer-comparison/Retro/integer-comparison.retro
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
:example (ab-)
|
||||
dup-pair gt? [ 'A>B s:put nl ] if
|
||||
dup-pair lt? [ 'A<B s:put nl ] if
|
||||
eq? [ 'A=B s:put nl ] if ;
|
||||
7
Task/Integer-comparison/VBA/integer-comparison.vba
Normal file
7
Task/Integer-comparison/VBA/integer-comparison.vba
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
Public Sub integer_comparison()
|
||||
first_integer = CInt(InputBox("Give me an integer."))
|
||||
second_integer = CInt(InputBox("Give me another integer."))
|
||||
Debug.Print IIf(first_integer < second_integer, "first integer is smaller than second integer", "first integer is not smaller than second integer")
|
||||
Debug.Print IIf(first_integer = second_integer, "first integer is equal to second integer", "first integer is not equal to second integer")
|
||||
Debug.Print IIf(first_integer > second_integer, "first integer is bigger than second integer", "first integer is not bigger than second integer")
|
||||
End Sub
|
||||
Loading…
Add table
Add a link
Reference in a new issue