+ Reply to Thread
Results 1 to 9 of 9

Thread: do you like my c++ game

  1. #1
    gordonm is offline x10Hosting Member gordonm is an unknown quantity at this point
    Join Date
    Mar 2009
    Posts
    6

    do you like my c++ game

    my very first game!

    here is the source
    #include <cstdlib>
    #include <iostream>

    using namespace std;

    int main(int argc, char *argv[])
    {
    //unknown
    int MyGuess(0);
    int Bob(1234);
    //another integer

    srand(time(NULL));
    //guess = rand()%10+1;
    cout << "enter a pin number for the info\n";
    cin >> MyGuess;
    //we tell the user the results
    if(MyGuess == Bob){//check if myguess is guess
    cout << "my password is blank\n";
    } else {//otherwise
    cout << "wrong ,try again!!!\n";
    cout << "you guessed " << MyGuess << " and you fail! here is what you should have got ";
    cout << Bob << "\n";
    }
    system("PAUSE");
    return EXIT_SUCCESS;
    }

    i just posted this for the crack!:happysad:

  2. #2
    daman371 is offline x10 Sophmore daman371 is an unknown quantity at this point
    Join Date
    Nov 2006
    Location
    Louisiana
    Posts
    130

    Re: do you like my c++ game

    I'm not so sure it actually works. I don't know what Bob is being set to.

  3. #3
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: do you like my c++ game

    Quote Originally Posted by gordonm View Post
    Code:
        int MyGuess(0);
        int Bob(1234);
    The preferred form is:
    Code:
        int MyGuess = 0;
        int Bob = 1234;
    Quote Originally Posted by gordonm View Post
    Code:
        srand(time(NULL));
        //guess = rand()%10+1;
    The game would be a little harder if you uncommented this line and changed "guess" to "Bob".

    Quote Originally Posted by gordonm View Post
    Code:
               cout << "wrong ,try again!!!\n";
               cout << "you guessed " << MyGuess << " and you fail! here is what you should have got ";
               cout <<  Bob << "\n";
    No need to repeat yourself.
    Code:
               cout << "wrong ,try again!!!\n"
                       << "you guessed " << MyGuess << " and you fail! here is what you should have got "
                       <<  Bob << "\n";
    Quote Originally Posted by gordonm View Post
    Code:
        system("PAUSE");
    You windows junkie. Just make sure you don't use system("PAUSE") for anything but the most trivial programs that are just for yourself. If anyone else is involved, use cin.ignore().

  4. #4
    gordonm is offline x10Hosting Member gordonm is an unknown quantity at this point
    Join Date
    Mar 2009
    Posts
    6

    Smile Re: do you like my c++ game

    Quote Originally Posted by misson View Post
    The preferred form is:
    Code:
        int MyGuess = 0;
        int Bob = 1234;

    The game would be a little harder if you uncommented this line and changed "guess" to "Bob".



    No need to repeat yourself.
    Code:
               cout << "wrong ,try again!!!\n"
                       << "you guessed " << MyGuess << " and you fail! here is what you should have got "
                       <<  Bob << "\n";

    You windows junkie. Just make sure you don't use system("PAUSE") for anything but the most trivial programs that are just for yourself. If anyone else is involved, use cin.ignore().
    can you help me with my cpp im a verry dumb beginer!

  5. #5
    garrettroyce's Avatar
    garrettroyce is offline Generally Helpful Member garrettroyce is a glorious beacon of lightgarrettroyce is a glorious beacon of light
    Join Date
    Apr 2008
    Location
    IL, USA
    Posts
    3,746

    Re: do you like my c++ game

    The C languages are not an easy place to start, don't get too down on yourself. You'll probably be learning something new every time you program, even 5 years from now. This is a decent tutorial: http://www.cplusplus.com/doc/tutorial/

    I'd recommend downloading Visual C++ Express Edition 2008 from Microsoft. It's free and it will help you tremendously. http://www.microsoft.com/express/download/
    gjr.gr - coming soon: secrets of OCD coding from a self taught tinkerer

  6. #6
    daman371 is offline x10 Sophmore daman371 is an unknown quantity at this point
    Join Date
    Nov 2006
    Location
    Louisiana
    Posts
    130

    Re: do you like my c++ game

    I've never seen that assignment for a variable before. I've taken 2 C++ courses in college. It's not too hard to pick up on. I mostly do stuff in PHP though, even though, in essence they are very similar. I do C++ programs for stuff I want to do locally and want to run quickly. Mainly Math programs.

  7. #7
    idontkno is offline x10Hosting Member idontkno is an unknown quantity at this point
    Join Date
    May 2009
    Posts
    49

    Re: do you like my c++ game

    Quote Originally Posted by misson View Post
    The preferred form is:
    Code:
        int MyGuess = 0;
        int Bob = 1234;
    The game would be a little harder if you uncommented this line and changed "guess" to "Bob".



    No need to repeat yourself.
    Code:
               cout << "wrong ,try again!!!\n"
                       << "you guessed " << MyGuess << " and you fail! here is what you should have got "
                       <<  Bob << "\n";
    You windows junkie. Just make sure you don't use system("PAUSE") for anything but the most trivial programs that are just for yourself. If anyone else is involved, use cin.ignore().
    cin.get() works as well for him in this case.

  8. #8
    cvrshop is offline x10Hosting Member cvrshop is an unknown quantity at this point
    Join Date
    Apr 2009
    Posts
    7

    Re: do you like my c++ game

    Sorry, I don't know, but thanks for your sharing.

  9. #9
    gordonm is offline x10Hosting Member gordonm is an unknown quantity at this point
    Join Date
    Mar 2009
    Posts
    6

    Re: do you like my c++ game

    hello all repliers ! !!!! thanks for all the help im going to make a revision of this in visual c++ as the other user suggested keep looking on this forum for an update whithin 2-4 days as im very busy with my current project

+ Reply to Thread

Similar Threads

  1. Game: Team A Vs. Team B
    By Blazer9131 in forum Forum Games
    Replies: 2583
    Last Post: 06-04-2010, 11:01 AM
  2. The x10 Hosting Game!!! The nex generation of gamming....
    By Coldfirezz in forum Gamer's Lounge
    Replies: 9
    Last Post: 12-20-2008, 05:13 AM
  3. Black Friday Game Deals
    By Kayos in forum Gamer's Lounge
    Replies: 5
    Last Post: 11-26-2008, 02:41 PM
  4. [Starblazer] Shockwave Game
    By Nova Ya in forum Introductions
    Replies: 1
    Last Post: 10-14-2007, 01:26 PM
  5. City Chaos - Game
    By Kay in forum Off Topic
    Replies: 4
    Last Post: 06-25-2006, 06:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers