01-04-2008, 07:57 PM
|
#1 (permalink)
|
|
Wizard
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
|
The hello world contest
I saw this on another forum a long time ago, it became quite an entertaining thread.
Purpose:
To create an application that prints out "Hello World' in the most inefficient way possible. Any language is acceptable.
Rules:
-1 source file only (as many non-executable files as you want)
-All commands must be relevant to the task, they cannot just take up space and do nothing on consequence.
-Messiness should not rely off of bad style alone, make it hard to read even if properly formatted. But format your code sloppy nonetheless.
I have two entries
PHP
http://justanotherportfolio.com/hello/hello.php
Code:
<?
class printletter{
public $letter;
function __construct($var){
$this->letter = preg_split('//', $var, -1, PREG_SPLIT_NO_EMPTY);;}}
function display($var){
foreach($var as $output){
if($output == " "){
$output = "space";}
$output = strtolower($output);
echo"<img src=\"$output.jpg\" alt=\" \">";}}
$originalstring = new printletter("Hello World");
display($originalstring->letter);
?>
C++
http://www.justanotherportfolio.com/hello/hello.exe
Code:
#include <iostream>
using namespace std;
int main()
{
char letter = 'a';
int hello[] = {7,-3,7,0,3};
int world[] = {8,-8,3,-6,-8};
letter = letter + hello[0]; cout << letter;
letter = letter + hello[1]; cout << letter;
letter = letter + hello[2]; cout << letter;
letter = letter + hello[3]; cout << letter;
letter = letter + hello[4]; cout << letter;
cout << " ";
letter = letter + world[0]; cout << letter;
letter = letter + world[1]; cout << letter;
letter = letter + world[2]; cout << letter;
letter = letter + world[3]; cout << letter;
letter = letter + world[4]; cout << letter;
cin >> letter;
}
|
|
|
|