Logo

Programming-Idioms

History of Idiom 120 > diff from v14 to v15

Edit summary for version 15 by :
[Python] spelling mistake.

Version 14

2016-02-17, 05:53:37

Version 15

2016-02-18, 16:58:03

Idiom #120 Read integer from stdin

Read an integer value from the standard input into variable n.

Idiom #120 Read integer from stdin

Read an integer value from the standard input into variable n.

Code
input_var = int(raw_input("Input Prompting String: "))
Code
input_var = int(raw_input("Input Prompting String: "))
Demo URL
http://pythonfiddle.com/read-integer-from-stdin
Demo URL
http://pythonfiddle.com/read-integer-from-stdin
Code
fscanf(STDIN, "%d\n", $number);
echo "Integer: {$number}\n";
Code
fscanf(STDIN, "%d\n", $number);
echo "Integer: {$number}\n";
Comments bubble
PHP can pull input from STDIN as an integer with %d
Comments bubble
PHP can pull input from STDIN as an integer with %d
Doc URL
http://php.net/manual/en/features.commandline.io-streams.php
Doc URL
http://php.net/manual/en/features.commandline.io-streams.php
Origin
http://php.net/manual/en/features.commandline.io-streams.php
Origin
http://php.net/manual/en/features.commandline.io-streams.php
Imports
#include <iostream>
Imports
#include <iostream>
Code
std::cin >> n;
Code
std::cin >> n;
Code
read(n);
Code
read(n);