Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
2
Task/User-input-Text/APL/user-input-text.apl
Normal file
2
Task/User-input-Text/APL/user-input-text.apl
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
str←⍞
|
||||
int←⎕
|
||||
11
Task/User-input-Text/Bracmat/user-input-text.bracmat
Normal file
11
Task/User-input-Text/Bracmat/user-input-text.bracmat
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
( doit
|
||||
= out'"Enter a string"
|
||||
& get':?mystring
|
||||
& whl
|
||||
' ( out'"Enter a number"
|
||||
& get':?mynumber
|
||||
& !mynumber:~#
|
||||
& out'"I said:\"a number\"!"
|
||||
)
|
||||
& out$(mystring is !mystring \nmynumber is !mynumber \n)
|
||||
);
|
||||
4
Task/User-input-Text/Elixir/user-input-text.elixir
Normal file
4
Task/User-input-Text/Elixir/user-input-text.elixir
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
a = IO.gets("Enter a string: ") |> String.strip
|
||||
b = IO.gets("Enter an integer: ") |> String.strip |> String.to_integer()
|
||||
IO.puts "String = #{a}"
|
||||
IO.puts "Integer = #{b}"
|
||||
11
Task/User-input-Text/Julia/user-input-text.julia
Normal file
11
Task/User-input-Text/Julia/user-input-text.julia
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
print("String? ")
|
||||
y = chomp(readline())
|
||||
println("Your input was \"", y, "\".\n")
|
||||
print("Integer? ")
|
||||
y = chomp(readline())
|
||||
try
|
||||
y = parseint(y)
|
||||
println("Your input was \"", y, "\".\n")
|
||||
catch
|
||||
println("Sorry, but \"", y, "\" does not compute as an integer.")
|
||||
end
|
||||
11
Task/User-input-Text/Oberon-2/user-input-text.oberon-2
Normal file
11
Task/User-input-Text/Oberon-2/user-input-text.oberon-2
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
MODULE InputText;
|
||||
IMPORT
|
||||
In,
|
||||
Out;
|
||||
VAR
|
||||
i: INTEGER;
|
||||
str: ARRAY 512 OF CHAR;
|
||||
BEGIN
|
||||
Out.String("Enter a integer: ");Out.Flush();In.Int(i);
|
||||
Out.String("Enter a string: ");Out.Flush();In.String(str);
|
||||
END InputText.
|
||||
|
|
@ -1,12 +1,10 @@
|
|||
/*REXX program gets a string and the number 75000 from the console. */
|
||||
|
||||
say 'Please enter a text string:' /*show prompt for a text string. */
|
||||
parse pull userString /*get the user text and store it.*/
|
||||
|
||||
do until userNumber=75000 /*repeat until correct.*/
|
||||
say /*display a blank line.*/
|
||||
say 'Please enter the number 75000' /*show the nice prompt.*/
|
||||
parse pull userNumber /*get the user text. */
|
||||
end /*until*/ /*now, check if it's OK*/
|
||||
|
||||
/*REXX pgm prompts and gets a string and also the # 75000 from terminal.*/
|
||||
say 'Please enter a string:'; parse pull userString
|
||||
say 'You entered this string:' userString /* show it on the console */
|
||||
/* [↑] string can be any length.*/
|
||||
do until userNumber=75000 /*repeat this loop until correct.*/
|
||||
say /*display blank line to terminal.*/
|
||||
say 'Please enter the number 75000' /*display a nice prompt message. */
|
||||
parse pull userNumber /*obtain the user text from term.*/
|
||||
end /*until ··· */ /*check if the response is legit.*/
|
||||
/*stick a fork in it, we're done.*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue