REM Notice that I'm using the ! (single percision) suffix. this is so our numbers will have decimals const SECONDS_IN_ONE_MINUTE! = 60.0 DIM total_seconds% total_seconds% = 1430 minutes% = INT(total_seconds! / SECONDS_IN_ONE_MINUTE!) REM minutes% should now equal 23.83333, but since we're using INT (converts the formula into an integer, and truncates the decimal), it will trim down to 23
seconds_remaining% = total_seconds! MOD SECONDS_IN_ONE_MINUTE! REM seconds_remaining% should now equal 50
const MINUTES_IN_ONE_HOUR! = 60.0 DIM total_minutes% total_minutes% = 147 hours% = INT(total_minutes% / MINUTES_IN_ONE_HOUR!) minutes_remaining% = total_minutes MOD SECONDS_IN_ONE_MINUTE!
DECLARE SUB GetTimeFromSmallerUnits(BYVAL total AS INTEGER, BYVAL unit_size AS SINGLE, BYREF bigger_unit AS INTEGER, BYREF remaining AS INTEGER ) DIM total_seconds% DIM seconds% DIM minutes% DIM hours% total_seconds% = 15091 GetTimeFromSmallerUnits(total_seconds%, 60, minutes%, seconds%) GetTimeFromSmallerUnits(minutes%, 60, hours%, minutes%) READ a$, b$, c# PRINT total_seconds%; "seconds is:" PRINT hours%; " hours" PRINT minutes%; "minutes" PRINT seconds%; "seconds" DATA "By Alex Barry at AllExperts.com QBasic Section", "February 9, 2015", 1423518565 SUB GetTimeFromSmallerUnits(BYVAL total AS INTEGER, BYVAL unit_size AS SINGLE, BYREF bigger_unit AS INTEGER, BYREF remaining AS INTEGER ) bigger_unit = INT(total / unit_size) remaining = total MOD unit_size END SUB
I have been a qbasic programmer since 2000, creating games, minor libraries and various small programs. I have experience using interrupts, graphics, file input/output, the mouse cursor, and using libraries. I have also learned FreeBASIC, QB64, c/c++, python, lua, php and html.
I do not claim to be an absolute authority in any language, but I don't mind looking things up and learning with you.
I have been programming in *Basic dialects since 2000, as mentioned in my expertise. After a year of QBasic, I learned C and C++, and dabbled a little in ASM (I don't program in ASM - I literally just played around to see how things work). When QB64 and FreeBASIC were released, I played with those languages. At the time, FreeBASIC offered more functionality and I sided with that language for a while. During that time, while I was learning new languages, that I would see what scripting languages are available, where I took up python and lua. I started to notice a staleness to QB64's development (which I kept tabs on from time to time), and am now trying to be active in it's community and maybe in it's development in the future.
Currently, I am only active on the QB64.net forums, but I appear on occasion on FreeBASIC.net's forums as well.
Highschool - 2007