Posted by oxaric on November 30, 2008
The first programming language I ever used was QBASIC. For a long time I used an early version of QBASIC that came free with DOS. It didn’t have the ability to compile code and you had to run all programs from within the QBASIC environment. I remember finding QBASIC 4.5 and thinking I had struck gold because it has the ability to compile code and create .exe files. Compiling not only gave a speed boost but allowed programs to be transportable to other computers. It was pretty amazing stuff.
I used to spend hours hacking away at QBASIC trying to create ’super awesome’ graphics programs. Ah the fond memories! :) I looked around and can only find one of my graphics program from the past. Unfortunately, it is an .exe file and not the source code. I’ve zipped and uploaded the program if you wish to check it out. It’s pretty cool so check it out! :)
It’s 2008 and there are a lot better languages to learn but QBASIC will always have a fond place in my heart. It’s still incredible to see what can be done with those old DOS graphics. I’ve zipped and uploaded QBASIC 4.5 so if you’ve never used it or have fond memories download it now and check it out. If you develop something cool I’d love to see it!
If you’re on a Linux machine you can run these programs using
dosemu. On a Windows machine I believe you should be able to run them from the command prompt.
Click to directly download QBASIC45.zip
Click to directly download cloud.zip
Posted in Programming, QBASIC | Tagged: 45, compile, DOS, graphics, old, Programming, QBASIC, qbasic 4.5, school | Leave a Comment »
Posted by oxaric on November 24, 2008
It uses Ruby.
Click to directly download euler-solution-45.rb
# filename 'euler-solution-45.rb' # By: Louis Casillas, oxaric@gmail.com
# Euler Problem #45 # After 40755, what is the next triangle number that is also pentagonal and hexagonal?
# Triangle Number: n * (n + 1) / 2.0 # Pentagonal Number: n * (3*n - 1) / 2.0 # Hexagonal Number: n * (2*n - 1)
# T(285) + P(165) + H(143) = 40755
# find the next one like this
def calcT( num ) (num * (num + 1) / 2.0).to_i end
def calcP( num ) (num * ((3 * num) - 1) / 2.0).to_i end
def calcH( num ) num * ((2 * num) - 1) end
def equalsPAndH( num ) temp_p = calcP( @pentagonal_bottom_limit ) temp_h = calcH( @hexagonal_bottom_limit )
if (num == temp_p) && (num == temp_h) return true end
while (temp_p < num ) @pentagonal_bottom_limit += 1 temp_p = calcP( @pentagonal_bottom_limit ) end
while (temp_h < num ) @hexagonal_bottom_limit += 1 temp_h = calcH( @hexagonal_bottom_limit ) end
false end
@triangle_bottom_limit = 286 @pentagonal_bottom_limit = 165 @hexagonal_bottom_limit = 143
found_one = false
while !found_one temp = calcT( @triangle_bottom_limit ) if equalsPAndH( temp ) puts "Found one: " + temp.to_s found_one = true else @triangle_bottom_limit += 1 end end
|
Posted in Programming, Project Euler, Ruby | Tagged: 45, answer, euler, forty-five, project, Ruby, solution | Leave a Comment »