year of birth guessing program. happy new year everyone

General FreeBASIC programming questions.
Post Reply
ron77
Posts: 212
Joined: Feb 21, 2019 19:24

year of birth guessing program. happy new year everyone

Post by ron77 »

hello here is something for the new year - may 2021 be a better year for all of us and all mankind.

Code: Select all

WINDOWTITLE("year of birth guessing")
SCREEN 19

DIM AS STRING ans1, age


INPUT "WHERE YOU BORN IN THE 20th CENTURY OR IN THE 21th CENTURY? (ENTER 20 OR 21 ONLY PLEASE): ", ans1
INPUT "what is your age today?: ", age

DIM result AS integer = 80 - VAL(age) + 40

IF ans1 = "20" THEN
   PRINT "I'M GUESSING YOU WHERE BORN IN THE YEAR 19" & result
ELSEIF ans1 = "21" THEN
   DIM milenial AS STRING = STR(result)
   milenial = right(milenial,2)
   PRINT "I'M GUESSING YOU WHERE BORN IN THE YEAR 20" & milenial
ENDIF

DIM ans2 AS STRING

INPUT "DID I GUESSED YOUR YEAR OF BIRTH CORRECTLY? (y/n): ", ans2      

IF ans2 = "y" THEN
   PRINT "GREAT... :) :p :D"
ELSE
   PRINT "WELL SORRY I GUESSED WRONG :("
ENDIF


SLEEP()
ron77...
Post Reply