Can all the computer programmers please read!!! I have a question for you.
Originally posted by moonpie
Here it is in perl:
#!/usr/bin/perl
print "Enter the temperature in Fahrenheitn";
chomp($fah = <STDIN>);
$cel = ($fah - 32) * (5/9);
print "The temperature in Celcius is $celn";
Here it is in perl:
#!/usr/bin/perl
print "Enter the temperature in Fahrenheitn";
chomp($fah = <STDIN>);
$cel = ($fah - 32) * (5/9);
print "The temperature in Celcius is $celn";
try this:
perl -pe 'print"Celcius:".($_-32)*(5/9);$_="";print"nEnter Farenheit:"'
61 characters
or without prompting,
perl -pe '$_=(($_-32)*5/9)."n"'
that's 21 characters
noone did php for the web:
<?php?>
<FORM ACTION='post' METHOD='<?echo $PHP_SELF?>'>
Farenheit: <INPUT TYPE='text' NAME='f' VALUE='<?echo $f?>'><?if ($c) { echo "is $c Celcius"; }?>
<INPUT TYPE='submit' NAME='s' VALUE='convert farenheit to celcius'>
<?php?>
<FORM ACTION='post' METHOD='<?echo $PHP_SELF?>'>
Farenheit: <INPUT TYPE='text' NAME='f' VALUE='<?echo $f?>'><?if ($c) { echo "is $c Celcius"; }?>
<INPUT TYPE='submit' NAME='s' VALUE='convert farenheit to celcius'>
here's MSIL
.method private hidebysig static void Main(string[] args) cil managed
{
.entrypoint
// Code size 66 (0x42)
.maxstack 3
.locals ([0] float64 f,[1] float64 c)
IL_0000: ldstr "Enter temp in F :"
IL_0005: call void [mscorlib]System.Console::WriteLine(string)
IL_000a: call string [mscorlib]System.Console::ReadLine()
IL_000f: call float64 [mscorlib]System.Double::Parse(string)
IL_0014: stloc.0
IL_0015: ldc.r8 0.55555555555555558
IL_001e: ldloc.0
IL_001f: ldc.r8 32.
IL_0028: sub
IL_0029: mul
IL_002a: stloc.1
IL_002b: ldstr "Celsius temperature is {0}"
IL_0030: ldloc.1
IL_0031: box [mscorlib]System.Double
IL_0036: call void [mscorlib]System.Console::WriteLine(string,object)
IL_003b: call string [mscorlib]System.Console::ReadLine()
IL_0040: pop
IL_0041: ret
}
.method private hidebysig static void Main(string[] args) cil managed
{
.entrypoint
// Code size 66 (0x42)
.maxstack 3
.locals ([0] float64 f,[1] float64 c)
IL_0000: ldstr "Enter temp in F :"
IL_0005: call void [mscorlib]System.Console::WriteLine(string)
IL_000a: call string [mscorlib]System.Console::ReadLine()
IL_000f: call float64 [mscorlib]System.Double::Parse(string)
IL_0014: stloc.0
IL_0015: ldc.r8 0.55555555555555558
IL_001e: ldloc.0
IL_001f: ldc.r8 32.
IL_0028: sub
IL_0029: mul
IL_002a: stloc.1
IL_002b: ldstr "Celsius temperature is {0}"
IL_0030: ldloc.1
IL_0031: box [mscorlib]System.Double
IL_0036: call void [mscorlib]System.Console::WriteLine(string,object)
IL_003b: call string [mscorlib]System.Console::ReadLine()
IL_0040: pop
IL_0041: ret
}
It seems we're one step away from making this the first annual OOULS2KIFCCC...
"The Obfuscated or Otherwise Useless Language S2000 International Fahrenheit-to-Celsius Converter Contest."
WHO WILL WIN??
- Warren
"The Obfuscated or Otherwise Useless Language S2000 International Fahrenheit-to-Celsius Converter Contest."
WHO WILL WIN??
- Warren



