How to resolve the algorithm Magic 8-ball step by step in the FreeBASIC programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Magic 8-ball step by step in the FreeBASIC programming language
Table of Contents
Problem Statement
Create Magic 8-Ball.
See details at: Magic 8-Ball.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Magic 8-ball step by step in the FreeBASIC programming language
Source code in the freebasic programming language
dim as string answer(0 to 19) = { "It is certain.", "It is decidedly so.", "Without a doubt.", "Yes – definitely.",_
"You may rely on it.", "As I see it, yes.", "Most likely.", "Outlook good.",_
"Yes.", "Signs point to yes.", "Reply hazy, try again.", "Ask again later.",_
"Better not tell you now.", "Cannot predict now.", "Concentrate and ask again.", "Don't count on it.",_
"My reply is no.", "My sources say no.", "Outlook not so good.", "Very doubtful." }
dim as string question
randomize timer
print "Q to quit."
do
input "What would you like to know? ", question
if ucase(question)="Q" then exit do
print answer(int(rnd*20))
print
loop
You may also check:How to resolve the algorithm String interpolation (included) step by step in the ARM Assembly programming language
You may also check:How to resolve the algorithm Tokenize a string step by step in the PHP programming language
You may also check:How to resolve the algorithm Compound data type step by step in the Icon and Unicon programming language
You may also check:How to resolve the algorithm Loops/With multiple ranges step by step in the Yabasic programming language
You may also check:How to resolve the algorithm Top rank per group step by step in the OCaml programming language