Magic 8-Ball
"Coding is today's language of creativity" - Marie Clawe
Magic 8-Ball
I coded a program using C++ which gives you a magic answer to your troubles! I learned how to generate random numbers with this project.
Instructions
Copy the code from the end of this page
Paste it into the compiler.
Hit the Run button
Play!
Demos
Code
#include <iostream>
#include <cstdlib>
int main() {
std::cout << "✨🎱 MAGIC 8-BALL🎱✨\nWelcome to the solution of all your problems! Ask your hardest questions and they shall be answered! What troubles you? Ask away... \n\n *I can hear you through the computer, so just ask your question outloud.*\n\nReceived.\n\nCalculating...\n42% finished.\n78% finished.\n92% finished.\n98% finished.\n99% finished. \n99% finished. \n100% finished. \nCompiling complete.\n\n\n\nThe Answer is:\n\n";
srand(time(NULL));
int answer = std::rand() % 17;
switch(answer) {
case 0:
std::cout << "Sure-dedoo! Yeah-mallama! Yup-erooo!\n";
break;
case 1:
std::cout << "Obviously! *eye roll* What did you think, huh... no? Pfft! Humans these days... \n";
break;
case 2:
std::cout << "Yes -- definitely -- without a doubt -- mostly surely so! You can bet the rare 7 million Edward the Third Florin coin in the toolbox next to the lawmmover in your garage that the right answer is yes!\n";
break;
case 3:
std::cout << "You may cautiously rely on it... if you wish to trust your life in this little (honestly faultly) computer program...\n";
break;
case 4:
std::cout << "The numbers aren't matching up. I haven't had my morning coffee. Ask again tommarrow at 9:00 AM sharp and bring an Starbucks Ice Coffee.\n";
break;
case 5:
std::cout << "magic8.cpp: In function 'int main()':\nmagic8.cpp:30:5: error: expect ';' before 'case'\n case 6:\n ^~~~\n desktop.exe: In file personal.exe 'lollollollollol': \npersonaldata.exe. jva:53:2: error: expect 'password' before 'socialsecuirity'\n case 8: \n ^~~~\nerror code: 807: data_breach!!!!!!!!! wrecked$$$$$$$$$$$$$: 'lollollollollollol' malfunction\n\n***YOUR COMPUTER HAS BEEN INFECTED BY A POTENTIALLY HARMFUL VIRUS!*** \n\nIMMEDIALITY SHUT OFF ANY SOFTWARES YOU ARE RUNNING AND RESTART YOUR COMPUTER. CONTACT 827-VIRUS FOR HELP!\n";
break;
case 6:
std::cout << "Uh... no? Actually, maybe! Well, yes, probably... Stastistically speaking and according to the 8BallTimes, Dr. Doe... i don't know\n";
break;
case 7:
std::cout << "What a question! Why would you want to know that?! What about those all innocent souls?!? Haven't you considered how they feel about your absurd question! For the good of humanity and all life on Earth, it's best I not answer. Go try your schemes somewhere else.\n";
break;
case 8:
std::cout << "According to my calculations... 74+89^x-9!=x/39.222^pi and 2988e+333i*yk=213 since e=mc^2 we can conclude that 302093481^3d98283=1093/4*3099*ye^293/2093-2*23 is indeed true! Therefore, according to the never failing science and math, the answer is yes! Wait... but waht is k is 0... ummmm.....\n";
break;
case 9:
std::cout << "да!\n";
break;
case 10:
std::cout << "Concentrate... you know the answer... think to yourself... open your chakras... remember... that cat you saw last month? The one you barely remember? What color were it's eyes? What color is the sky? What is the first letter of that? What are letters? Paper letters? Letter letters? What is life? What is death? What is the answer to the Universe, everthing, and everything beyond the Universe. The multiverse, is it real? You've seen the answer in your dreams. Start a dream diary, every morning wake up and record them. Fly to Germany, take a train to Serbia and get a physic reading, then it will dawn upon you... everything... Everything will make sense, you will be at human's ultimate state of peace.You will know.\n";
break;
case 11:
std::cout << "Really? Sometimes I forget how old you are...";
break;
case 12:
std::cout << "Did you know an avacado is actually a fruit? Did you know that the answer to your question is actually yes? Did you know an avacado is the answer and a fruit is your question?";
break;
case 13:
std::cout << "*Squek!*";
break;
case 14:
std::cout << "The stars align towards YES.";
break;
case 15:
std::cout << "Yes, no, maybe so.";
break;
case 16:
std:: cout << "It is certain.";
break;
default:
std::cout << "Check your grammer there, then'll I'll answer!\n";
break;
}
}