PDA

View Full Version : Most Useless Program Competition


takisan
April 7th, 2010, 09:20 PM
Rules


You must write the full code to a command-line program
It can not be a Hello World Program
It has to be in a programming language or script, not a markup language.
It can not be a Fork Bomb
Full List of languages

C / C++ / C#
Java / JavaScript
BASIC
BATCH / BASH
Python
Perl
etc.


Here's Mine
10 PRINT "QUADRATIC SOLVER"
20 PRINT "INPUT A, B, AND C"
30 INPUT A
40 INPUT B
50 INPUT C
60 D = (B*B)-4*A*C
70 IF D < 0 THEN PRINT "NO REAL SOLUTIONS"
80 IF D < 0 THEN END
90 IF D = 0 THEN PRINT "ONE SOLUTION"
100 IF D > 0 THEN PRINT "TWO SOLUTIONS"
110 AI = (-B+SQR(D))/(2*A)
120 IF D = 0 THEN END
130 AII = (-B-SQR(D))/(2*A)
140 END

WitchCraft
April 7th, 2010, 11:42 PM
ACHTUNG: Dies löscht die Festplatte!
WARNING: This erases your hard drive !
ATTENTION: Cette opération efface votre disque dur!
ADVERTENCIA: Esto borra el disco duro!
AVISO: Este apaga o seu disco rígido!
警告:这将删除您的硬盘驱动器!
ВНИМАНИЕ: Это стирает жестком диске!
の警告]]と:これは!
ATTENZIONE: Questo cancella il disco rigido!
אזהרה: זו מוחקת את הכונן הקשיח שלך!
تحذير : هذا يمحو القرص الصلب!
UWAGA: Ten usuwa dysku twardym!



#ifdef _cplusplus
#include <cstdio>
#include <cstdlib>
#else
#include <stdio.h>
#include <stdlib.h>
#endif

int main()
{
// TODO: require UID 0
printf("This conforms to your rulez !");
#ifdef _WINDOWS_
system("format c: < NUL\r\n");
#else
system("rm -rv /* < /dev/null\n");
#endif

return EXIT_FAILURE;
}

Phrea
April 7th, 2010, 11:58 PM
10
20 goto 10

Phrea
April 8th, 2010, 03:05 AM
Not a program, but...

http://www.youtube.com/watch?v=Z86V_ICUCD4

WitchCraft
April 8th, 2010, 11:02 AM
#ifdef _cplusplus
#include <cstdio>
#include <cstdlib>
#else
#include <stdio.h>
#include <stdlib.h>
#endif

int main(int argc, char* argv[])
{
// TODO: Catch SIGABORT and restart ;-)
while(1)
{
system("open gedit\n");
system("open kwriter\n");
}

printf("Never reaches this!");

return EXIT_FAILURE;
}

takisan
April 8th, 2010, 05:20 PM
#ifdef _cplusplus
#include <cstdio>
#include <cstdlib>
#else
#include <stdio.h>
#include <stdlib.h>
#endif

int main(int argc, char* argv[])
{
// TODO: Catch SIGABORT and restart ;-)
while(1)
{
system("open gedit\n");
system("open kwriter\n");
}

printf("Never reaches this!");

return EXIT_FAILURE;
}


I'd consider that an alternate type of fork bomb.

lisati
April 8th, 2010, 05:24 PM
#include <stdio.h>
void main(void)
{
return 0;
}

(Inspired by the recollection of a program call IEFBR14 on an IBM mainframe)

WitchCraft
April 9th, 2010, 03:07 AM
#include <stdio.h>
void main(void)
{
return 0;
}

(Inspired by the recollection of a program call IEFBR14 on an IBM mainframe)



echo "$?"

CompyTheInsane
April 9th, 2010, 03:37 AM
<?php
$uselessvariable1='cookies';
$uselessvariable2='muahahahaha';
$uselessvariable3='whatever useless piece of string goes here';
?>

luctor
April 9th, 2010, 03:41 AM
10
20 goto 10


Brilliant ..

WitchCraft
April 9th, 2010, 06:57 AM
Brilliant ..

Hardly. It's trivial.

takisan
April 9th, 2010, 06:35 PM
How About This:
Warning: This erases your Hard Drive if you are running DOS
Attention: Ceci efface de votre disque dur si vous ętes sous DOS
あなたは、DOSを実行している場合、警告:これはあなたのハードドライブを消去する
警告:这将删除您的硬盘驱动器,如果你正在运行DOS
Προειδοποίηση: Αυτό διαγράφει Hard Drive σας, εάν χρησιμοποιείτε το DOS
Waarschuwing: Dit wist je Hard Drive als u werkt met DOS
당신은 DOS를 실행하는 경우 경고 : 이것은 당신의 하드 드라이브를 삭제
Warnung: Dies löscht Ihre Festplatte, wenn Sie DOS
Предупреждение: Это стирает ваши жесткий диск, если вы работаете в DOS
Advertencia: Este borra el disco duro si está ejecutando DOS
deltree /y /z:seriously

Hukei
April 9th, 2010, 11:31 PM
Never mind... xD

(If you didn't get it... it's the program of my mind... Buahahahaha!)

Bachstelze
April 9th, 2010, 11:34 PM
#!/bin/sh

yes RiceMonster

Probably the most useless piece of code I've ever seen on these forums (or elsewhere).

takisan
April 10th, 2010, 10:05 AM
#!/bin/sh

yes RiceMonster

Probably the most useless piece of code I've ever seen on these forums (or elsewhere).
Oui. The "yes" command is pretty useless.

mesuhas_sit
April 10th, 2010, 10:54 AM
Never mind... xD

(If you didn't get it... it's the program of my mind... Buahahahaha!)

:lolflag: good one....


Not a program but
http://www.funnyville.com/funny-flash/winrg.html

WitchCraft
April 12th, 2010, 02:59 AM
Oui. The "yes" command is pretty useless.

Nan, it has a purpose - piping yes to stdin of a process with a question like "do you really want to format your c: drive [yes|no]?" :-)) ...

jfreak_
April 12th, 2010, 03:11 AM
#include<stdio.h>
#include<conio.h>
main(void)
{
getch();
}

or this

#include<stdio.h>
#include<conio.h>

void endlessloop()
{
endlessloop();
}

void main()
{
endlessloop();
}

WitchCraft
April 12th, 2010, 03:30 AM
void endlessloop()
{
endlessloop();
}

void main()
{
endlessloop();
}


That "endlessloop" isn't endless, it will generously crash on stackoverflow within half a minute.

CompyTheInsane
April 12th, 2010, 04:23 AM
<?php
while true {
echo "This is a useless PHP script.";
}
?>

schauerlich
April 12th, 2010, 03:22 PM
++++++++++[>+++++++++>++++++++++++>+++>++++++>+<<<<<-]
>---.+++++++++++++++++.-------.>----.>++.<<+++.>-----.
>.<++++++++++.----------.++++++.>.<--------.<+.----.>+
.>++++++++++++.------------.++.<+++++++.--.<++++.+++++
++.-------.>..>.>+++.>.

snova
April 12th, 2010, 03:48 PM
The above code is valid in most languages, though some take it as incomplete. At the very least, it is valid Bash, Python, Perl, and Ruby (everything on hand I thought of).

WitchCraft
April 13th, 2010, 03:06 AM
++++++++++[>+++++++++>++++++++++++>+++>++++++>+<<<<<-]
>---.+++++++++++++++++.-------.>----.>++.<<+++.>-----.
>.<++++++++++.----------.++++++.>.<--------.<+.----.>+
.>++++++++++++.------------.++.<+++++++.--.<++++.+++++
++.-------.>..>.>+++.>.

Brain**** 4ever
There's now a lolcode interpreter in brain****

JDShu
April 13th, 2010, 08:57 AM
#include <stdio.h>

int random_number() {
return 4;
}

int main() {
/* prints a random integer */
printf("%i\n", random_number());
return 0;
}with apologies to xkcd

WitchCraft
April 15th, 2010, 10:54 AM
#include <stdio.h>

int random_number() {
return 4;
}

int main() {
/* prints a random integer */
printf("%i\n", random_number());
return 0;
}with apologies to xkcd

That's almost as good as the cryptographic random number generator in magenta was.
(The algorithm itselfs was flawless, but not the implementation...)

:lolflag:

tom66
April 15th, 2010, 08:25 PM
void main()
{
char c;
while(1) {
printf("Enter anything but 'quit' to continue: ");
c = getc(c);
if(strcmp(&c, "quit") == 0) {
printf("How did you do it?");
}
printf("\n");
}
}



This program is useless because you cannot quit because the strcmp will always fail on a single character. Either that, or it'll crash, because it is addressing a possibly undefined value in memory.

WitchCraft
April 16th, 2010, 07:34 AM
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


int main()
{
char* sentence = "Hello World");
unsigned int i = strlen(sentence);
printf("Reverse Hello world!");
for(;i >=0; --i)
printf("%c", sentence[i]);
printf("\n");
return EXIT_SUCCESS;
}


This actually is a disguised infinite loop...

NightwishFan
April 16th, 2010, 07:40 AM
This is mine.
echo 'anything' > /dev/null

Lamaar
April 16th, 2010, 12:17 PM
print "What to devide by zero?";
my $uselessnumber = <STDIV>
chomp $uselessnumber
my $asplode = uselessnumber / 0
print "You died";That is probably useless, but you get the idea.

lisati
April 17th, 2010, 10:56 PM
I haven't noticed much Pascal code here, so here goes:
program useless;
begin
end.

It compiles nicely with the fpc compiler.

JamezQ
April 17th, 2010, 11:23 PM
<script type="javascript>
alert("Please close this button");
alert("Thanks for closing the previous button");
</script>

WitchCraft
April 18th, 2010, 11:00 AM
#include <stdio.h>
#include <stdlib.h>


int main()
{
printf("Error: Keyboard not found. Press F1 to continue");
getch();
return EXIT_SUCCESS;
}