User Input: Difference between revisions

Content added Content deleted
m (→‎Input a number: Changed to works with template)
m (It turns out the whole task needed works with)
Line 4: Line 4:


=={{header|Ada}}==
=={{header|Ada}}==
'''Compiler:''' [[GCC]] 4.1.2
{{works with|GCC|4.1.2}}

function Get_String return String is
function Get_String return String is
Line : String (1 .. 1_000);
Line : String (1 .. 1_000);
Line 30: Line 29:
~
~
=={{header|BASIC}}==
=={{header|BASIC}}==
'''Compiler:''' [[QuickBasic]] 4.5
{{works with|QuickBasic|4.5}}
INPUT "Enter a string: ", s$
INPUT "Enter a string: ", s$
INPUT "Enter a number: ", i%
INPUT "Enter a number: ", i%


'''Compiler:''' [[FreeBASIC]]
{{works with|FreeBASIC}}
dim s as string
dim s as string
dim i as integer
dim i as integer
Line 52: Line 51:


=={{header|C}}==
=={{header|C}}==
{{works with|gcc}}
'''Compiler:''' [[gcc]]
#include <stdio.h>
#include <stdio.h>
int main(int argc, char* argv[])
int main(int argc, char* argv[])
Line 66: Line 65:


=={{header|C++}}==
=={{header|C++}}==
{{works with|g++}}
'''Compiler:''' [[g++]]
#include <iostream>
#include <iostream>
#include <istream>
#include <istream>
Line 160: Line 159:


=={{header|Java}}==
=={{header|Java}}==
'''Interpreter:''' [[Java]]

import java.io.BufferedReader;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStreamReader;
Line 175: Line 172:
or
or


'''Interpreter:''' [[Java]] >= 1.5/5.0
{{works with|Java|1.5/5.0+}}

import java.util.Scanner;
import java.util.Scanner;
Line 184: Line 180:


=={{header|mIRC Scripting Language}}==
=={{header|mIRC Scripting Language}}==
'''Editor:''' [[mIRC]]

alias askmesomething {
alias askmesomething {
echo -a You answered: $input(What's your name?, e)
echo -a You answered: $input(What's your name?, e)
Line 191: Line 185:


=={{header|newLISP}}==
=={{header|newLISP}}==
'''Interpreter:''' [[newLISP]] v.9.0
{{works with|newLISP|9.0}}
(print "Enter an integer: ")
(print "Enter an integer: ")
(set 'x (read-line))
(set 'x (read-line))
Line 210: Line 204:


=={{header|Perl}}==
=={{header|Perl}}==
'''Interpreter:''' [[Perl]] 5.8.8
{{works with|Perl|5.8.8}}
#!/usr/bin/perl
#!/usr/bin/perl
Line 217: Line 211:


=={{header|PHP}}==
=={{header|PHP}}==
'''Interpreter:''' [[PHP]] with CLI SAPI
{{works with|CLI SAPI}}
#!/usr/bin/php
#!/usr/bin/php
<?php
<?php
Line 235: Line 229:


=={{header|PostScript}}==
=={{header|PostScript}}==
{{works with|PostScript|level-2}}
'''Interpreter:''' Any level-2 PS interpreter

%open stdin for reading (and name the channel "kbd"):
%open stdin for reading (and name the channel "kbd"):
/kbd (%stdin) (r) file def
/kbd (%stdin) (r) file def
Line 266: Line 259:


=={{header|Ruby}}==
=={{header|Ruby}}==
'''Interpreter:''' [[Ruby]] 1.8.4
{{works with|Ruby|1.8.4}}

print "Enter a string: "
print "Enter a string: "
s = gets
s = gets
Line 301: Line 293:


=={{header|UNIX Shell}}==
=={{header|UNIX Shell}}==
'''Interpreter:''' [[Debian Almquish SHell]] (dash)
{{works with|Debian Almquish SHell}}

#!/bin/sh
#!/bin/sh
Line 308: Line 299:
read INTEGER
read INTEGER
'''Interpreter:''' [[Bourne Again SHell]] (bash)
{{works with|Bourne Again SHell}}

#!/bin/bash
#!/bin/bash
Line 323: Line 313:


=={{header|Java}}==
=={{header|Java}}==
'''Interpreter:''' Sun [[Java]]

{{libheader|Swing}}
{{libheader|Swing}}


Line 337: Line 325:


=={{header|Python}}==
=={{header|Python}}==
'''Interpreter:''' [[Python]] 2.5
{{works with|Python|2.5}}

{{libheader|Tkinter}}
{{libheader|Tkinter}}


Line 362: Line 349:


=={{header|VBScript}}==
=={{header|VBScript}}==
'''Interpreter:''' [[Windows Script Host]]
{{works with|Windows Script Host}}

strUserIn = InputBox("Enter Data")
strUserIn = InputBox("Enter Data")
Wscript.Echo strUserIn
Wscript.Echo strUserIn