Source Code: Wha's Me Freekin Number

Description

Guess the number with a drunken lephrecaun.

Instructions

Type in your guess.

Known Bugs

If you enter a string, it goes bugshit crazy. For now, it only works with numbers.

// wha's me freekin' number for C++
// a simple evil leprechaun number guessing game
// yes, this example is so well known and so overdone we included an evil
// leprechaun.
 
#include <cstdlib>
#include <ctime>
#include <iostream>
 
using namespace std;
 
int main()
{
    int guess;
    int freekin_number;
    int game_over = false;
 
    srand((unsigned)time(0));
    freekin_number = rand()%100 + 1;
 
    cout << endl;
    cout << " WHA'S ME FREEKIN' NUMBER?" << endl << endl;
    cout << " You were wandering in the woods one day, taking in the sights, minding" << endl;
    cout << " your own business, when you found that you had rudely intruded upon the" << endl;
    cout << " drunken leprechaun area of the forest." << endl << endl;
 
    cout << " As sure as leprechuan's are an ugly shade of green, one of them appears" << endl;
    cout << " and says :" << endl << endl;
 
    cout << " Ye hav' stepped upon me' house, and me hav'n jus' painted 'er a purty" << endl;
    cout << " shade of green. If ye wants ter git outta 'is forest alive, yer gonna" << endl;
    cout << " haf'ta answer me riddle:" << endl << endl;
 
    cout << " Me gives ye a hint. 'Tis betwixt 1 an' 100." << endl << endl;
 
    do
    {
        cout << endl << " Wha's me freekin' number? " << endl << endl;
        cout << " > ";
        cin >> guess;
        cout << endl;
 
        if ( freekin_number < guess )
        {
            cout << " Tha's not me freekin' number! 'Tis low'r, ye tard!" << endl;
        }
        if ( freekin_number > guess )
        {
            cout << " Tha's not me freekin' number! 'Tis high'r, ye tard!" << endl;
        }
        if ( freekin_number == guess )
        {
            cout << " Tha's me freekin' number!" << endl;
            cout << " 'Tis true, I'm the " << freekin_number << "-unth son o' me father." << endl;
            cout << " Me half father. Now git!" << endl << endl;
            game_over = true;
        }
    }
    while( !game_over );
 
    return 0;
}
Categories: Source Code
page_revision: 2, last_edited: 1246052828|%e %b %Y, %H:%M %Z (%O ago)