CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 13 of 13

Thread: Blackjack Game

  1. #1
    Join Date
    Apr 2012
    Posts
    8

    Question Blackjack Game

    This place seems like they don't want the help you solve your issues you are facing, but telling you are o go f yourself.
    Last edited by MrMario; March 11th, 2014 at 11:06 AM.

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: Blackjack Game

    This forum is for Visual c++ - and this code looks more like c#.

    [Moderator please would you move to appropriate forum - thanks]
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  3. #3
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Blackjack Game

    Quote Originally Posted by MrMario View Post
    I have a game "Blackjack" that's attached and I need help with trying to get the program working correctly.

    Few problems:

    1. When you click bet and then click either hit or stay, the Player textbox will not show the card, but will only show the word " of " and same for the dealer textbox.
    2. Doesn't matter what you click hit or stay, you are either losing or gaining money with each click, which should only happen if you are closer to 21 or on 21
    3. When you close the game, clicking "Quit", its suppose to create a log of the results for each time you play, but its not.
    4. If I click "Play Again" and try to play again it doesn't reset the last game information.
    Did you write the program? If so, then you should be responsible for debugging your own programs. What debugging have you done so far?

    Regards,

    Paul McKenzie

  4. #4
    Join Date
    Apr 2012
    Posts
    8

    Re: Blackjack Game

    Quote Originally Posted by 2kaud View Post
    This forum is for Visual c++ - and this code looks more like c#.

    [Moderator please would you move to appropriate forum - thanks]
    This is C++. I think I would know my own language I'm studying...

    Quote Originally Posted by Paul McKenzie View Post
    Did you write the program? If so, then you should be responsible for debugging your own programs. What debugging have you done so far?

    Regards,

    Paul McKenzie
    Umm a load of time, I'm asking for help, if you can't provide that, move a long....

  5. #5
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: Blackjack Game

    Code:
    private: System::Windows::Forms::Button^  betButton;
    This is managed c++ - so the correct forum is 'managed c++ and c++/cli'.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Blackjack Game

    Quote Originally Posted by MrMario View Post
    This is C++. I think I would know my own language I'm studying...
    At least the Form1.h file has nothing to do with the Visual C++. And it is not a native C++ either!

    Quote Originally Posted by MrMario View Post
    Umm a load of time, I'm asking for help, if you can't provide that, move a long....
    Well, what do you mean by "help" in this context? Would you like that we debug your code for you?
    Note that you will never be able develop any software unless you will debug it!
    Victor Nijegorodov

  7. #7
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Blackjack Game

    Quote Originally Posted by MrMario View Post
    Umm a load of time, I'm asking for help,
    Then what is your specific question? You didn't post one. So the only thing to assume is that you want us to debug the program. You didn't state "I'm passing a variable x and it changes for some reason to a value I didn't expect" or "the function returns a bad address" or "whenever I copy an object, the original object gets corrupted", or anything like that. You just listed what was wrong with the program in general, as if you're not a programmer, but an end-user.

    As to debugging -- debugging doesn't mean "change the code and hope it works". It means you take the debugger, and see where the program goes against what you expected. Then you take note of what the debugging session showed you to aid in fixing the program (or you scrap your original plan and think up another design if the design you initially chosen won't work). Again, you wrote the program, so there is absolutely no excuse why you can't debug the very program that you wrote.

    For example:
    If I click "Play Again" and try to play again it doesn't reset the last game information.
    So place a breakpoint at the point in the code where the "Play Again" button click logic is invoked. Step through it using the debugger. Where does the logic flow go in another direction where you didn't expect? Is there an if() statement, function call, whatever that does or does not get executed when you expected it to not execute / execute? Etc...etc...

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; March 11th, 2014 at 09:55 AM.

  8. #8
    Join Date
    Apr 2012
    Posts
    8

    Re: Blackjack Game

    Now I remember why I hated this place.

  9. #9
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: Blackjack Game

    Quote Originally Posted by MrMario View Post
    Now I remember why I hated this place.
    Because you are expecting us to do the work of debugging your program for you rather than you putting in the work to find the problem. People who reply here to posts have other jobs. They are not going to start looking through pages of code or start debugging some one else's code of the size you posted.

    Programming is a lot more than just writing some code. There is also design and debugging.

    Put in the effort with the debugger, find where the code deviates from that expected from your design and then if you don't understand why something is/is not happening then post a specifc question to the right forum.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  10. #10
    Join Date
    Apr 2012
    Posts
    8

    Re: Blackjack Game

    Quote Originally Posted by 2kaud View Post
    Because you are expecting us to do the work of debugging your program for you rather than you putting in the work to find the problem. People who reply here to posts have other jobs. They are not going to start looking through pages of code or start debugging some one else's code of the size you posted.

    Programming is a lot more than just writing some code. There is also design and debugging.

    Put in the effort with the debugger, find where the code deviates from that expected from your design and then if you don't understand why something is/is not happening then post a specifc question to the right forum.
    Nope, its because you are telling me where this should go instead of helping me aka point me in the right direction and if you see something fishy by just looking at the code. If you all have jobs and are too busy, why the heck are you on a forum? Clearly I'm just going to go somewhere else and get help, since no one wants to do so here.

    I'M OUT!

  11. #11
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: Blackjack Game

    Not directly related to your problem, but looking through the code you have statements like this
    Code:
    	if (points < n)
    		return true;
    	else
    		return false;
    This can be replaced by
    Code:
    return points < n;
    and likewise for other similar statements.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  12. #12
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: Blackjack Game

    Quote Originally Posted by MrMario View Post
    Nope, its because you are telling me where this should go instead of helping me aka point me in the right direction and if you see something fishy by just looking at the code. If you all have jobs and are too busy, why the heck are you on a forum? Clearly I'm just going to go somewhere else and get help, since no one wants to do so here.

    I'M OUT!
    If your code had been standard c++ instead of managed c++ then I would have loaded it up into my MSVC and had a quick look. As it's mananged c++, you posted to the wrong forum as I pointed out in a previous post. People with different skills look at different forums. So if you want specific replies then you need to post to the correct forum where people with those skills view the posts.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  13. #13
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Blackjack Game

    Quote Originally Posted by MrMario View Post
    Nope, its because you are telling me where this should go instead of helping me aka point me in the right direction and if you see something fishy by just looking at the code.
    You was pointed in the right direction. And it happened at least twice:
    1. In this thread (about two years ago)<
    2. In the current thread.

    Quote Originally Posted by MrMario View Post
    Clearly I'm just going to go somewhere else and get help, since no one wants to do so here.
    Many people did want to help. But you do not accept it!

    Quote Originally Posted by MrMario View Post
    I'M OUT!
    Pity!
    But it is up to you...

    PS: nevertheless, I am now moving this thread to the Managed C++ Forum
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured