Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
14
Task/Integer-comparison/ALGOL-W/integer-comparison.alg
Normal file
14
Task/Integer-comparison/ALGOL-W/integer-comparison.alg
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
begin
|
||||
|
||||
integer a, b;
|
||||
|
||||
write( "first number: " );
|
||||
read( a );
|
||||
write( "second number: " );
|
||||
read( b );
|
||||
|
||||
if a < b then write( a, " is less than ", b );
|
||||
if a = b then write( a, " is equal to ", b );
|
||||
if a > b then write( a, " is greater than ", b );
|
||||
|
||||
end.
|
||||
11
Task/Integer-comparison/Batch-File/integer-comparison.bat
Normal file
11
Task/Integer-comparison/Batch-File/integer-comparison.bat
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
@echo off
|
||||
setlocal EnableDelayedExpansion
|
||||
set /p a="A: "
|
||||
set /p b="B: "
|
||||
if %a% LSS %b% (
|
||||
echo %a% is less than %b%
|
||||
) else ( if %a% GTR %b% (
|
||||
echo %a% is greater than %b%
|
||||
) else ( if %a% EQU %b% (
|
||||
echo %a% is equal to %b%
|
||||
)))
|
||||
24
Task/Integer-comparison/ColdFusion/integer-comparison-1.cfm
Normal file
24
Task/Integer-comparison/ColdFusion/integer-comparison-1.cfm
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<cffunction name="CompareInteger">
|
||||
<cfargument name="Integer1" type="numeric">
|
||||
<cfargument name="Integer2" type="numeric">
|
||||
<cfset VARIABLES.Result = "" >
|
||||
<cfif ARGUMENTS.Integer1 LT ARGUMENTS.Integer2 >
|
||||
<cfset VARIABLES.Result = VARIABLES.Result & "(" & ARGUMENTS.Integer1 & " is less than " & ARGUMENTS.Integer2 & ")" >
|
||||
</cfif>
|
||||
<cfif ARGUMENTS.Integer1 LTE ARGUMENTS.Integer2 >
|
||||
<cfset VARIABLES.Result = VARIABLES.Result & "(" & ARGUMENTS.Integer1 & " is less than or equal to " & ARGUMENTS.Integer2 & ")" >
|
||||
</cfif>
|
||||
<cfif ARGUMENTS.Integer1 GT ARGUMENTS.Integer2 >
|
||||
<cfset VARIABLES.Result = VARIABLES.Result & "(" & ARGUMENTS.Integer1 & " is greater than " & ARGUMENTS.Integer2 & ")" >
|
||||
</cfif>
|
||||
<cfif ARGUMENTS.Integer1 GTE ARGUMENTS.Integer2 >
|
||||
<cfset VARIABLES.Result = VARIABLES.Result & "(" & ARGUMENTS.Integer1 & " is greater than or equal to " & ARGUMENTS.Integer2 & ")" >
|
||||
</cfif>
|
||||
<cfif ARGUMENTS.Integer1 EQ ARGUMENTS.Integer2 >
|
||||
<cfset VARIABLES.Result = VARIABLES.Result & "(" & ARGUMENTS.Integer1 & " is equal to " & ARGUMENTS.Integer2 & ")" >
|
||||
</cfif>
|
||||
<cfif ARGUMENTS.Integer1 NEQ ARGUMENTS.Integer2 >
|
||||
<cfset VARIABLES.Result = VARIABLES.Result & "(" & ARGUMENTS.Integer1 & " is not equal to " & ARGUMENTS.Integer2 & ")" >
|
||||
</cfif>
|
||||
<cfreturn VARIABLES.Result >
|
||||
</cffunction>
|
||||
24
Task/Integer-comparison/ColdFusion/integer-comparison-2.cfm
Normal file
24
Task/Integer-comparison/ColdFusion/integer-comparison-2.cfm
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<cfscript>
|
||||
function CompareInteger( Integer1, Integer2 ) {
|
||||
VARIABLES.Result = "";
|
||||
if ( ARGUMENTS.Integer1 LT ARGUMENTS.Integer2 ) {
|
||||
VARIABLES.Result = VARIABLES.Result & "(" & ARGUMENTS.Integer1 & " is less than " & ARGUMENTS.Integer2 & ")";
|
||||
}
|
||||
if ( ARGUMENTS.Integer1 LTE ARGUMENTS.Integer2 ) {
|
||||
VARIABLES.Result = VARIABLES.Result & "(" & ARGUMENTS.Integer1 & " is less than or equal to " & ARGUMENTS.Integer2 & ")";
|
||||
}
|
||||
if ( ARGUMENTS.Integer1 GT ARGUMENTS.Integer2 ) {
|
||||
VARIABLES.Result = VARIABLES.Result & "(" & ARGUMENTS.Integer1 & " is greater than " & ARGUMENTS.Integer2 & ")";
|
||||
}
|
||||
if ( ARGUMENTS.Integer1 GTE ARGUMENTS.Integer2 ) {
|
||||
VARIABLES.Result = VARIABLES.Result & "(" & ARGUMENTS.Integer1 & " is greater than or equal to " & ARGUMENTS.Integer2 & ")";
|
||||
}
|
||||
if ( ARGUMENTS.Integer1 EQ ARGUMENTS.Integer2 ) {
|
||||
VARIABLES.Result = VARIABLES.Result & "(" & ARGUMENTS.Integer1 & " is equal to " & ARGUMENTS.Integer2 & ")";
|
||||
}
|
||||
if ( ARGUMENTS.Integer1 NEQ ARGUMENTS.Integer2 ) {
|
||||
VARIABLES.Result = VARIABLES.Result & "(" & ARGUMENTS.Integer1 & " is not equal to " & ARGUMENTS.Integer2 & ")";
|
||||
}
|
||||
return VARIABLES.Result;
|
||||
}
|
||||
</cfscript>
|
||||
5
Task/Integer-comparison/DCL/integer-comparison.dcl
Normal file
5
Task/Integer-comparison/DCL/integer-comparison.dcl
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
$ inquire a "Please provide an integer"
|
||||
$ inquire b "Please provide another"
|
||||
$ if a .lt. b then $ write sys$output "the first integer is less"
|
||||
$ if a .eq. b then $ write sys$output "the integers have the same value"
|
||||
$ if a .gt. b then $ write sys$output "the first integer is greater"
|
||||
30
Task/Integer-comparison/Eiffel/integer-comparison.e
Normal file
30
Task/Integer-comparison/Eiffel/integer-comparison.e
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
class
|
||||
APPLICATION
|
||||
inherit
|
||||
ARGUMENTS
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
local
|
||||
i, j: INTEGER_32
|
||||
do
|
||||
io.read_integer_32
|
||||
i := io.last_integer_32
|
||||
|
||||
io.read_integer_32
|
||||
j := io.last_integer_32
|
||||
|
||||
if i < j then
|
||||
print("first is less than second%N")
|
||||
end
|
||||
if i = j then
|
||||
print("first is equal to the second%N")
|
||||
end
|
||||
if i > j then
|
||||
print("first is greater than second%N")
|
||||
end
|
||||
end
|
||||
end
|
||||
11
Task/Integer-comparison/Elixir/integer-comparison.elixir
Normal file
11
Task/Integer-comparison/Elixir/integer-comparison.elixir
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{a,_} = IO.gets("Enter your first integer: ") |> Integer.parse
|
||||
{b,_} = IO.gets("Enter your second integer: ") |> Integer.parse
|
||||
|
||||
cond do
|
||||
a < b ->
|
||||
IO.puts "#{a} is less than #{b}"
|
||||
a > b ->
|
||||
IO.puts "#{a} is greater than #{b}"
|
||||
a == b ->
|
||||
IO.puts "#{a} is equal to #{b}"
|
||||
end
|
||||
7
Task/Integer-comparison/Emacs-Lisp/integer-comparison.l
Normal file
7
Task/Integer-comparison/Emacs-Lisp/integer-comparison.l
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
(progn
|
||||
(if (< 1 2) (insert "True\n") (insert "False\n") )
|
||||
(if (= 1 2) (insert "True\n") (insert "False\n") )
|
||||
(if (= 1 1) (insert "True\n") (insert "False\n") )
|
||||
(if (> 1 2) (insert "True\n") (insert "False\n") )
|
||||
(if (<= 1 2) (insert "True\n") (insert "False\n") )
|
||||
(if (>= 1 2) (insert "True\n") (insert "False\n") ))
|
||||
|
|
@ -21,6 +21,6 @@ function compare (a, b) {
|
|||
}
|
||||
} else {
|
||||
// "1" and 1 are an example of this as the first is type string and the second is type number
|
||||
print(a + "{" + (typeof a) + "} and " + b + "{" + (typeof b) + "} are not of the same type 4and cannot be compared.");
|
||||
print(a + "{" + (typeof a) + "} and " + b + "{" + (typeof b) + "} are not of the same type and cannot be compared.");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
11
Task/Integer-comparison/NewLISP/integer-comparison.newlisp
Normal file
11
Task/Integer-comparison/NewLISP/integer-comparison.newlisp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
(print "Please enter the first number: ")
|
||||
(set 'A (int (read-line)))
|
||||
(print "Please enter the second number: ")
|
||||
(set 'B (int (read-line)))
|
||||
(println
|
||||
"The first one is "
|
||||
(cond
|
||||
((> A B) "greater than")
|
||||
((= A B) "equal to")
|
||||
(true "less than"))
|
||||
" the second.")
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
a = int(raw_input('Enter value of a: '))
|
||||
b = int(raw_input('Enter value of b: '))
|
||||
a = input('Enter value of a: ')
|
||||
b = input('Enter value of b: ')
|
||||
|
||||
if a < b:
|
||||
print 'a is less than b'
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
import sys
|
||||
try:
|
||||
a = int(raw_input('Enter value of a: '))
|
||||
b = int(raw_input('Enter value of b: '))
|
||||
a = input('Enter value of a: ')
|
||||
b = input('Enter value of b: ')
|
||||
except (ValueError, EnvironmentError), err:
|
||||
print sys.stderr, "Erroneous input:", err
|
||||
sys.exit(1)
|
||||
|
|
|
|||
|
|
@ -1,15 +1,19 @@
|
|||
use std::io;
|
||||
use std::io::{self, BufRead};
|
||||
|
||||
fn main() {
|
||||
// #![allow(unstable)] // Currently required whilst Rust 1.0 is finalised
|
||||
let a: i32 = from_str(io::stdin().read_line().unwrap().trim().as_slice()).unwrap();
|
||||
let b: i32 = from_str(io::stdin().read_line().unwrap().trim().as_slice()).unwrap();
|
||||
|
||||
let result =
|
||||
match (a, b) {
|
||||
(a, b) if a < b => format!("{0} is less than {1}" , a , b),
|
||||
(a, b) if a == b => format!("{0} equals {1}" , a , b),
|
||||
(a, b) => format!("{0} is greater than {1}" , a , b),
|
||||
};
|
||||
println!("{0}" , result);
|
||||
let mut reader = io::stdin();
|
||||
let mut buffer = String::new();
|
||||
let mut lines = reader.lock().lines().take(2);
|
||||
let nums: Vec<i32>= lines.map(|string|
|
||||
string.unwrap().trim().parse().unwrap()
|
||||
).collect();
|
||||
let a: i32 = nums[0];
|
||||
let b: i32 = nums[1];
|
||||
if a < b {
|
||||
println!("{} is less than {}" , a , b)
|
||||
} else if a == b {
|
||||
println!("{} equals {}" , a , b)
|
||||
} else if a > b {
|
||||
println!("{} is greater than {}" , a , b)
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
Prompt A,B
|
||||
If A<B: Disp "A SMALLER B"
|
||||
If A>B: Disp "A GREATER B"
|
||||
If A=B: Disp "A EQUAL B"
|
||||
|
|
@ -8,3 +8,4 @@
|
|||
<xsl:when test="$a = $b">a = b</xsl:when>
|
||||
</xsl:choose>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue