Results 1 to 15 of 15
  1. #1
    Aggorance's Avatar
    Join Date
    Aug 2011
    Gender
    male
    Posts
    5
    Reputation
    10
    Thanks
    1

    Guess Number Game

    Code:
    #include <iostream>
    #include <ctime>
    #include <cstdlib>
    using namespace std;
    
    int main(int argc, char** argv)
    {
            system("TITLE Guess My Number.");
            system("COLOR 5");
    
    	srand(static_cast<unsigned int>(time(0)));
    
    	int iMyNumber;
    	int iYourNumber;
    	int iPoints = 5;
          
    	while(true)
    	{
    		cin.clear();
    		iMyNumber = rand() % 100 + 1;
    		
    		cout << "You start with 5 points, each spin cost 1 point." << endl; 
    		cout << "Guess my Number '1 - 100'" << endl;
    		cout << "Get as many points as you can!" << endl;
    		do
    		{
    			cout << "Enter your Number ";
    			cin >> iYourNumber;
                iPoints += -1;
    			if (iYourNumber > iMyNumber)
    				cout << "Too high!" << endl << endl;
    			else if (iYourNumber < iMyNumber)
    				cout << "Too low!" << endl << endl;
    		} while (iYourNumber != iMyNumber);
    		cout << "Correct!" << endl << endl;
    		cout << "You've got " << iPoints << " points." << endl << endl;
    		cin.get();
    	}
    	return 0;
    }

  2. #2
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    Did you ever got a correct answer with this ?

  3. #3
    Aggorance's Avatar
    Join Date
    Aug 2011
    Gender
    male
    Posts
    5
    Reputation
    10
    Thanks
    1
    Quote Originally Posted by Hassan View Post
    Did you ever got a correct answer with this ?
    Yes, I've played it multiple times.

  4. #4
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    Like this ?





    Edit:


    You've got -2 points. lolwut?
    Last edited by Hassan; 09-02-2011 at 01:37 AM.

  5. #5
    master131's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Melbourne, Australia
    Posts
    8,858
    Reputation
    3438
    Thanks
    101,677
    My Mood
    Breezy
    Code:
    iPoints += -1; //Should be iPoints++;
    lol, fail. Positive and negative = negative.
    Donate:
    BTC: 1GEny3y5tsYfw8E8A45upK6PKVAEcUDNv9


    Handy Tools/Hacks:
    Extreme Injector v3.7.3
    A powerful and advanced injector in a simple GUI.
    Can scramble DLLs on injection making them harder to detect and even make detected hacks work again!

    Minion Since: 13th January 2011
    Moderator Since: 6th May 2011
    Global Moderator Since: 29th April 2012
    Super User/Unknown Since: 23rd July 2013
    'Game Hacking' Team Since: 30th July 2013

    --My Art--
    [Roxas - Pixel Art, WIP]
    [Natsu - Drawn]
    [Natsu - Coloured]


    All drawings are coloured using Photoshop.

    --Gifts--
    [Kyle]

  6. #6
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by Hassan View Post
    Like this ?





    Edit:


    You've got -2 points. lolwut?
    Genius -.-

    I made my hint a little more complicated The hint points to a pointer which points to a struct whose third field points to a pointer which points to the value. GLHF

    EDIT

    @master131, hey genius when you get a wrong answer you lose a point, not gain one. Derp.
    @Hassan lol he forgot to give you points when you get a correct answer
    Last edited by Jason; 09-02-2011 at 01:45 AM.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  7. #7
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    @Jason: lol, looks way easy to crack.

    @master131: You got owned ;P

  8. #8
    Aggorance's Avatar
    Join Date
    Aug 2011
    Gender
    male
    Posts
    5
    Reputation
    10
    Thanks
    1
    I'm new to C++, thanks though -.-..

  9. #9
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    Quote Originally Posted by Aggorance View Post
    I'm new to C++, thanks though -.-..
    Obviously, and don't mind. We're just having a little fun *apparently* ^^

  10. #10
    master131's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Melbourne, Australia
    Posts
    8,858
    Reputation
    3438
    Thanks
    101,677
    My Mood
    Breezy
    lol, what I supposed to write was this:
    iPoints--; not iPoints++;

    Although what the OP wrote is still OK it's not good practice.
    Donate:
    BTC: 1GEny3y5tsYfw8E8A45upK6PKVAEcUDNv9


    Handy Tools/Hacks:
    Extreme Injector v3.7.3
    A powerful and advanced injector in a simple GUI.
    Can scramble DLLs on injection making them harder to detect and even make detected hacks work again!

    Minion Since: 13th January 2011
    Moderator Since: 6th May 2011
    Global Moderator Since: 29th April 2012
    Super User/Unknown Since: 23rd July 2013
    'Game Hacking' Team Since: 30th July 2013

    --My Art--
    [Roxas - Pixel Art, WIP]
    [Natsu - Drawn]
    [Natsu - Coloured]


    All drawings are coloured using Photoshop.

    --Gifts--
    [Kyle]

  11. #11
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by master131
    lol, what I supposed to write was this:
    iPoints--; not iPoints++;
    Bullshit.

    Quote Originally Posted by master131 View Post
    Code:
    iPoints += -1; //Should be iPoints++;

    lol, fail. Positive and negative = negative.
    Yes, "fail" that he got it right

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  12. #12
    Aggorance's Avatar
    Join Date
    Aug 2011
    Gender
    male
    Posts
    5
    Reputation
    10
    Thanks
    1
    Quote Originally Posted by Jason View Post


    Bullshit.



    Yes, "fail" that he got it right
    Same as Java, in that aspect.

  13. #13
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Same as all C-style syntax languages

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  14. #14
    kibbles18's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Location
    US
    Posts
    860
    Reputation
    5
    Thanks
    127
    alternatives to
    Code:
    var += -1
    or var += 1
    Code:
    var++
    var--
    ++var
    --var

  15. #15
    yair's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Posts
    50
    Reputation
    10
    Thanks
    1
    hahahaha i had to do this project for my programming class...it was simple and fun

Similar Threads

  1. [Release] Guess That Number Game
    By sherkun in forum Visual Basic Programming
    Replies: 11
    Last Post: 11-17-2010, 02:32 AM
  2. Guess The Game
    By HannibalJr in forum Spammers Corner
    Replies: 5
    Last Post: 08-25-2010, 08:06 PM
  3. Magic Number game
    By ez2animate in forum C++/C Programming
    Replies: 11
    Last Post: 08-17-2010, 04:17 AM
  4. The Number Game
    By Austin in forum Spammers Corner
    Replies: 7
    Last Post: 06-17-2010, 03:38 AM
  5. THE NUMBER GAME!!!!
    By zebramanz in forum General
    Replies: 27
    Last Post: 03-29-2009, 11:09 PM