Jump to content

Menu: Difference between revisions

464 bytes added ,  12 years ago
no edit summary
(Add Seed7 example)
No edit summary
Line 1,016:
Which is from the three pigs? 2
-> "huff and puff"</pre>
 
=={{header|PHP}}==
<lang php><?php
$stdin = fopen("php://stdin", "r");
$allowed = array(1 => 'fee fie', 'huff and puff', 'mirror mirror', 'tick tock');
 
for(;;) {
foreach ($allowed as $id => $name) {
echo " $id: $name\n";
}
echo "Which is from the four pigs: ";
$stdin_string = fgets($stdin, 4096);
if (isset($allowed[(int) $stdin_string])) {
echo "You chose: {$allowed[(int) $stdin_string]}\n";
break;
}
}</lang>
 
=={{header|PowerShell}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.