News:

Welcome to RetroCoders Community

Main Menu

one of my first programs in FB

Started by ron77, Sep 15, 2022, 01:06 PM

Previous topic - Next topic

ron77

here is a little program I wrote when first started with freeBASIC when covid started in early 2020

It's a small epidemiologic simulator of covid (coronavirus) it was made in the "qb" dialct of freebasic since I didn't know the full FB dialect

#Lang"qb"
'_TITLE "CORONA VIRUS"
Screen 0 
'DIM Shared As ULongInt
Dim Shared INFECTIONSull 'As unsigned Integer
Dim Shared DEATHSull 'As unsigned Integer
Dim Shared POPull 'As unsigned Integer
Dim Shared DAYS AS Integer
INFECTIONSull = 1




SUB cp (row, s$)
    LOCATE row, (80 - LEN(s$)) / 2: PRINT s$
END SUB

SUB opening
    cp 2, "CORONA VIRUS"
    cp 4, "A EXPERINENT IN EPIDEMIOLOGY"
    cp 6, "PRESS ANY KEY TO CONTINUE"
    DO
    LOOP UNTIL INKEY$ <> ""
END SUB

SUB corona
    CLS
    LOCATE 5, 5
    INPUT "ENTER POPULATION'S NUMBER: ", POPull

    DO
        CLS
        PRINT "DAY: " + STR$(DAYS)
        PRINT "INFECTIONS: " + STR$(int(INFECTIONSull))
        PRINT "DEATHS: " + STR$(Int(DEATHSull))
        PRINT "POPULATION: " + STR$(Int(POPull - DEATHSull))
        Sleep 1
        DAYS = DAYS + 1
        INFECTIONSull = INFECTIONSull * 2
        IF INFECTIONSull > 1000 THEN DEATHSull = INFECTIONSull * 34 / 1000

    LOOP UNTIL INFECTIONSull > POPull
	Print "press any key..."
	sleep
END SUB

opening
corona

johnno56

Hey Ron.

Do you think that you should provide masks for this... lol

J
May your journey be free of incident.  Live long and prosper.