A fun little 8Ball project
I decided to make an 8Ball program just for fun. Here is the source:
#include <iostream>
#include <stdlib.h>
#include <ctime>
int main()
{
srand(time(NULL));
std::cout << "Welcome to your future!!! (8Ball)." << std::endl;
std::cout << "What do you want to get the answer to? | Ask here: " << std::endl;
std::string user_input;
std::cin >> user_input;
std::cout << "The 8Ball says!! ..." << std::endl;
int result = (rand() % 20) + 1;
switch (result) {
case 1:
std::cout << "It is certain." << std::endl;
break;
case 2:
std::cout << "It is decidedly so." << std::endl;
break;
case 3:
std::cout << "Without a doubt." << std::endl;
break;
case 4:
std::cout << "Yes, definitely." << std::endl;
break;
case 5:
std::cout << "You can rely on it." << std::endl;
break;
case 6:
std::cout << "As I see it, yes." << std::endl;
break;
case 7:
std::cout << "Most likely." << std::endl;
break;
case 8:
std::cout << "Outlook good." << std::endl;
break;
case 9:
std::cout << "Yes." << std::endl;
break;
case 10:
std::cout << "Signs point to yes." << std::endl;
break;
case 11:
std::cout << "Reply hazy, try again." << std::endl;
break;
case 12:
std::cout << "Ask again later." << std::endl;
break;
case 13:
std::cout << "Better not tell you now." << std::endl;
break;
case 14:
std::cout << "Cannot predict now." << std::endl;
break;
case 15:
std::cout << "Concentrate and ask again." << std::endl;
break;
case 16:
std::cout << "Don't count on it." << std::endl;
break;
case 17:
std::cout << "My reply is no." << std::endl;
break;
case 18:
std::cout << "My sources say no." << std::endl;
break;
case 19:
std::cout << "Outlook not so good." << std::endl;
break;
case 20:
std::cout << "Very doubtful." << std::endl;
break;
default:
std::cout << "Something went wrong :(";
}
}