here is a smoking calculator - answer 3 simple questions and this program will calculate for you:
1. how much cigarettes you smoked so far (ruffly)
2. how much money you spent on cigarettes (ruffly)
3. how much time you lost from you lifespan (ruffly - 5 min for each cigarette)
Code: Select all
windowtitle "smoking caculator"
SCREEN 19
DIM SHARED as double years, packs, cost
SUB cp (row as integer, s as string)
LOCATE row, (100 - LEN(s)) / 2: PRINT s
END SUB
SUB calculate
dim as double totalCigarettes, lost, lostTime, lostMoney
totalCigarettes = years * 365 * packs * 20
lost = totalCigarettes * 5
lostTime = lost / 60 / 24 / 365
lostMoney = years * 365 * packs * cost
CLS
cp 4, "YOU SMOKED " + STR(totalCigarettes) + " CIGARETTES IN YOUR LIFE TIME SO FAR"
cp 6, "YOU LOST " + STR(lostTime) + " YEARS FROM YOUR LIFE CAUSE OF SMOKING"
cp 8, "YOU SPENDED " + STR(lostMoney) + "$ ON SMOKING IN YOUR LIFE SO FAR"
cp 10, "SMOKING IS BAD FOR YOU PLEASE CONSIDER QUITTING FOR GOOD"
COLOR 31: cp 12, "PRESS ANY KEY TO END AND QUIT PROGRAM...": COLOR 7
SLEEP
END SUB
INPUT "HOW MANY YEARS DO YOU SMOKE?: ", years
INPUT "HOW MANY PACKS OF CIGARETTES IN A DAY DO YOU SMOKE?: ", packs
INPUT "HOW MUCH DOES A PACK OF CIGARETTES COSTS YOU?: ", cost
CLS
COLOR 31: cp 4, "PRESS ANY KEY TO GET CALCULATIONS": COLOR 7
SLEEP
calculate