Another update from ingydotnet^djgoku

This commit is contained in:
Ingy döt Net 2015-11-18 06:14:39 +00:00
parent 91df62d461
commit 948b86eafa
7604 changed files with 108452 additions and 22726 deletions

View file

@ -0,0 +1,2 @@
str
int

View 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)
);

View 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}"

View 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

View 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.

View file

@ -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.*/