Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- #include <cstdlib>
- #include <string>
- using namespace std;
- //Randomizes the good message.
- void GoodMessage()
- {
- int seedg;
- seedg = 1 + rand()%5;
- if(seedg == 1)
- cout << "You will marry Ms. Teacher.\n";
- else if(seedg == 2)
- cout << "You'll become a millionaire.\n";
- else if(seedg == 3)
- cout << "You'll date a super-model.\n";
- else if(seedg == 4)
- cout << "You're gonna find the cure for cancer.\n";
- else
- cout << "You'll become a wizard.\n";
- }
- //Randomizes the bad message.
- void BadMessage()
- {
- int seedb;
- seedb = 1 + rand()%5;
- if(seedb == 1)
- cout << "You'll become ugly.\n";
- else if(seedb == 2)
- cout << "You'll go into poverty.\n";
- else if(seedb == 3)
- cout << "You'll die alone. D:\n";
- else if(seedb == 4)
- cout << "You're gonna get robbed.\n";
- else
- cout << "You'll become a wizard, but then a spell will backfire and you'll die.\n";
- }
- //Randomizes the 8-Ball.
- void EightBall()
- {
- int seed8;
- seed8 = 1 + rand()%3;
- if(seed8 == 1)
- cout << "Yes.\n";
- else if(seed8 == 2)
- cout << "Maybe.\n";
- else
- cout << "No.\n";
- }
- int main()
- {
- int seed, mode, trubd;
- char response;
- string q;
- trubd = 0;
- //Allows user to choose between Crystal or 8 Ball.
- cout << "Select mode:\n";
- cout << " 1) Crystal Ball\n";
- cout << " 2) Magic 8 Ball\n";
- cin >> mode;
- if(mode == 1){
- //Crystal Ball
- do{
- srand(time(0));
- seed = rand()%2;
- system("cls");
- cout << "Welcome to my crystal ball. Give it a rub.\n";
- system("pause");
- system("cls");
- if(seed == 0){
- GoodMessage();
- }
- else{
- BadMessage();
- }
- trubd += 1;
- //Displays the times rubbed and a custom message based on the times rubbed.
- cout << "Times rubbed: " << trubd << endl;
- if(trubd == 3){
- cout << "Good for you, knowing your future.\n";
- }
- else if(trubd == 6){
- cout << "Wow. You REALLY wanna know your fortunes huh?\n";
- }
- else if(trubd == 10){
- cout << "Dear god. Get a life and live in the present. -_-\n";
- }
- else if(trubd > 10){
- cout << "Please go away. You're bugging me.\n";
- }
- cout << "\nWould you like to rub again? (y/n): ";
- cin >> response;
- }while(response == 'y');
- }
- else{
- //8-Ball
- do{
- srand(time(0));
- system("cls");
- cout << "What is your question?\n";
- cin.ignore();
- getline(cin, q);
- EightBall();
- cout << "\nWould you like to ask another question? (y/n): ";
- cin >> response;
- }while(response == 'y');
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement