Sync
This commit is contained in:
parent
6f050a029e
commit
776bba907c
3887 changed files with 59894 additions and 7280 deletions
2
Task/User-input-Text/BASIC/user-input-text-1.basic
Normal file
2
Task/User-input-Text/BASIC/user-input-text-1.basic
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
INPUT "Enter a string"; s$
|
||||
INPUT "Enter a number: ", i%
|
||||
2
Task/User-input-Text/BASIC/user-input-text-2.basic
Normal file
2
Task/User-input-Text/BASIC/user-input-text-2.basic
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
10 INPUT "ENTER A STRING: "; S$
|
||||
20 INPUT "ENTER A NUMBER: ", I%
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
@echo off
|
||||
set /p var=
|
||||
echo %var%
|
||||
echo %var% 75000
|
||||
|
|
|
|||
17
Task/User-input-Text/COBOL/user-input-text.cobol
Normal file
17
Task/User-input-Text/COBOL/user-input-text.cobol
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. Get-Input.
|
||||
|
||||
DATA DIVISION.
|
||||
WORKING-STORAGE SECTION.
|
||||
01 Input-String PIC X(30).
|
||||
01 Input-Int PIC 9(5).
|
||||
|
||||
PROCEDURE DIVISION.
|
||||
DISPLAY "Enter a string:"
|
||||
ACCEPT Input-String
|
||||
|
||||
DISPLAY "Enter a number:"
|
||||
ACCEPT Input-Int
|
||||
|
||||
GOBACK
|
||||
.
|
||||
16
Task/User-input-Text/Logtalk/user-input-text-1.logtalk
Normal file
16
Task/User-input-Text/Logtalk/user-input-text-1.logtalk
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
:- object(user_input).
|
||||
|
||||
:- public(test/0).
|
||||
test :-
|
||||
repeat,
|
||||
write('Enter an integer: '),
|
||||
read(Integer),
|
||||
integer(Integer),
|
||||
!,
|
||||
repeat,
|
||||
write('Enter an atom: '),
|
||||
read(Atom),
|
||||
atom(Atom),
|
||||
!.
|
||||
|
||||
:- end_object.
|
||||
4
Task/User-input-Text/Logtalk/user-input-text-2.logtalk
Normal file
4
Task/User-input-Text/Logtalk/user-input-text-2.logtalk
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
| ?- user_input::test.
|
||||
Enter an integer: 75000.
|
||||
Enter an atom: 'Hello world!'.
|
||||
yes
|
||||
15
Task/User-input-Text/Racket/user-input-text.rkt
Normal file
15
Task/User-input-Text/Racket/user-input-text.rkt
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#lang racket
|
||||
(printf "Input a string: ")
|
||||
(define s (read-line))
|
||||
(printf "You entered: ~a\n" s)
|
||||
|
||||
(printf "Input a number: ")
|
||||
(define m (or (string->number (read-line))
|
||||
(error "I said a number!")))
|
||||
(printf "You entered: ~a\n" m)
|
||||
|
||||
;; alternatively, use the generic `read'
|
||||
(printf "Input a number: ")
|
||||
(define n (read))
|
||||
(unless (number? n) (error "I said a number!"))
|
||||
(printf "You entered: ~a\n" n)
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
print("Enter a number: ")
|
||||
val i=Console.readInt
|
||||
val i=Console.readLong // Task says to enter 75000
|
||||
print("Enter a string: ")
|
||||
val s=Console.readLine
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue