Qbasicnews.com
Shortest useful program - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: QbasicNews.Com (http://qbasicnews.com/newforum/forum-3.html)
+--- Forum: Challenges (http://qbasicnews.com/newforum/forum-10.html)
+--- Thread: Shortest useful program (/thread-1705.html)

Pages: 1 2 3 4 5


Shortest useful program - ak00ma - 08-17-2003

Quote:
ak00ma Wrote:... Here's a better round function... ( I only changed one thing )
Code:
DEF FNround# (m#, dec%) = SGN(m#) * INT(10^dec% * ABS(m#) + .5) / 10 ^ dec%
AK00MA:
Excellent, although you didn't declare what feature you added. I assume from the code that dec% declares the number of IMPLIED decimals contained in the number in m#. If this is the case, then you enhanced Oracle's general purpose function with this added feature.
*****

Oh...sorry..I forgot it. Yeah, you're right..


Shortest useful program - oracle - 08-18-2003

I've got a 3 line function that does that in the WIKI, I may just change it if one line will do.


Shortest useful program - Moneo - 08-22-2003

Here's a little function of common usage:
Code:
' ============================ FILLSTRING =================================
' Converts value (V#) to string of specified length (L) with leading zeros.
' =========================================================================
FUNCTION FillString$ (V#,L) STATIC
   FILLSTRING$=right$(STRING$(L,"0")+LTRIM$(STR$(V#)),L)
END FUNCTION
*****


Shortest useful program - pr0gger - 08-23-2003

whitetiger, just so you know: Both the NAND and NOR functions will always produce the same result.

So "X NAND Y = X NOR Y". Smile


Shortest useful program - whitetiger0990 - 08-23-2003

Truth tables

NAND
0 0 1
0 1 1
1 0 1
1 1 0

NOR
0 0 1
0 1 0
1 0 0
1 1 0

umm.


Shortest useful program - Moneo - 08-23-2003

Quote:whitetiger, just so you know: Both the NAND and NOR functions will always produce the same result.

So "X NAND Y = X NOR Y". Smile

Sorry, Progger, that's not true. If it were, why would they bother having both operators?

A NAND is the same as an AND, but reversing the bits (NOT) on the output.

A NOR is the same as an OR, but reversing the bits (NOT) on the output.

Since AND and OR are different, then NAND and NOR are different.
*****


Shortest useful program - otaku84 - 10-14-2003

heres a 5 line arcade style game.

Code:
DO
a=a+1
IF a>10 THEN a=0
PRINT "Final hardcore scores of yours = "; a
LOOP UNTIL INKEY$ <> ""

To make it more fun, play it with friends, and the one with the lowest score loses a finger. Trust me, very exciting. Or you could just implement a dare system.


Shortest useful program - oracle - 10-15-2003

You should get it to print only when someone presses a key Smile


Shortest useful program - seph - 10-15-2003

Here you go:

Code:
INPUT "Pick a number between 1 and 65,535: ", port&
OUT port&, INT(RND * 256)
PRINT "Port "; port&; " successfully f*cked up."



Shortest useful program - SCM - 10-15-2003

Seph,
the title of this thread is the shortest useful program. The annoying programs were another thread.