Learn Programming in 24 hours

This is a discussion on Learn Programming in 24 hours within the Windows Programming forums, part of the Platform Specific Boards category; Hi Im currently using book "Learn your self programming in 24 hours" (somethink like that) I am reading czech version ...

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    162

    Learn Programming in 24 hours

    Hi Im currently using book "Learn your self programming in 24 hours" (somethink like that) I am reading czech version by the way but that is probably not the cause of the problem.

    There are some sources prepared to be used which are also meant to be learned from. But my compiler is not able to compile any source from the book. Means that I cant try it myself.

    Does anyone have some experiences with this book?

    Dev-C++
    VSC++

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    20,980
    Do you have a short but complete example of such code? If so, it would be good to provide it. If not, then the book was probably not properly tailored to beginners.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,344
    The problem with an awful lot of books is they're written with a specific compiler in mind. If that's not yours, then you're out of luck.

    It's even worse if you do have the compiler, because inevitably, you end up learning a lot of compiler specific junk and a "works for me" mentality about your code.

    http://www.rafb.net/efnet_cpp/books/
    http://www.accu.org/index.php/book_reviews
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    When you get errors, fix them, most of the time different compilers just allow different exeptions and sytaxes, just alter the code to make it work, and if you can't, post the code and the errors you get.

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    20,980
    Unfortunately, Queatrix, a beginner would not know where to start fixing errors. If they do, they are past the beginner stage.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #6
    Registered User
    Join Date
    Apr 2007
    Posts
    162
    Quote Originally Posted by laserlight View Post
    Unfortunately, Queatrix, a beginner would not know where to start fixing errors. If they do, they are past the beginner stage.
    You made a good point I try to fix the code but not successfully. The source is created by 6 files I paste here just one if it is enough, because I dont want to waste your time.

    Code:
    //-----------------------------------------------------------------
    // Game Skeleton Application
    // C++ Source - Skeleton.cpp
    //-----------------------------------------------------------------
    
    //-----------------------------------------------------------------
    // Include Files
    //-----------------------------------------------------------------
    #include "Skeleton.h"
    
    //-----------------------------------------------------------------
    // Game Engine Functions
    //-----------------------------------------------------------------
    BOOL GameInitialize(HINSTANCE hInstance)
    {
      // Create the game engine
      _pGame = new GameEngine(hInstance, TEXT("Game Skeleton"),
        TEXT("Game Skeleton"), IDI_SKELETON, IDI_SKELETON_SM);
      if (_pGame == NULL)
        return FALSE;
      
      // Set the frame rate
      _pGame->SetFrameRate(15);
    
      return TRUE;
    }
    
    void GameStart(HWND hWindow)
    {
      // Seed the random number generator
      srand(GetTickCount());
    }
    
    void GameEnd()
    {
      // Cleanup the game engine
      delete _pGame;
    }
    
    void GameActivate(HWND hWindow)
    {
      HDC   hDC;
      RECT  rect;
    
      // Draw activation text on the game screen
      GetClientRect(hWindow, &rect);
      hDC = GetDC(hWindow);
      DrawText(hDC, TEXT("Activated!"), -1, &rect,
        DT_SINGLELINE | DT_CENTER | DT_VCENTER);
      ReleaseDC(hWindow, hDC);
    }
    
    void GameDeactivate(HWND hWindow)
    {
      HDC   hDC;
      RECT  rect;
    
      // Draw deactivation text on the game screen
      GetClientRect(hWindow, &rect);
      hDC = GetDC(hWindow);
      DrawText(hDC, TEXT("Deactivated!"), -1, &rect,
        DT_SINGLELINE | DT_CENTER | DT_VCENTER);
      ReleaseDC(hWindow, hDC);
    }
    
    void GamePaint(HDC hDC)
    {
    }
    
    void GameCycle()
    {
      HDC   hDC;
      HWND  hWindow = _pGame->GetWindow();
    
      // Draw the skeleton icon at random positions on the game screen
      hDC = GetDC(hWindow);
      DrawIcon(hDC, rand() % _pGame->GetWidth(), rand() % _pGame->GetHeight(),
        (HICON)(WORD)GetClassLong(hWindow, GCL_HICON));
      ReleaseDC(hWindow, hDC);
    }
    I am not really sure if it help because As i said its just one fie out of six.

    Dev-C++
    MSVC++
    P.S. The code should be available in MSVC++ at least the writers say it.

  7. #7
    Registered User
    Join Date
    May 2006
    Posts
    903
    All those functions are part of a class named GameEngine, you will need to add GameEngine:: before every function. If you do not understand what I just said, put the book away for a moment and go back on your basics (not meant to be mean).

    (I own this book in French)

  8. #8
    Registered User pronecracker's Avatar
    Join Date
    Oct 2006
    Location
    netherlands
    Posts
    158
    <sigh>

    That book is not called "Learn programming in 24 hours", but "Game Programming in 24 hours".
    And it is assumed that you already know C++, as is clearly and explicitly said in the preface.
    You need to learn C++, not to make 2d games.

  9. #9
    Registered User
    Join Date
    Apr 2007
    Posts
    162
    Quote Originally Posted by pronecracker View Post
    <sigh>

    That book is not called "Learn programming in 24 hours", but "Game Programming in 24 hours".
    And it is assumed that you already know C++, as is clearly and explicitly said in the preface.
    You need to learn C++, not to make 2d games.
    I used to programme in C++ console apps. But no previous experiences with winAPI.
    Therefor thx for previous help from everyone. I will learn winAPI first before I continue the book.

    P.S. Sorry about the name I used, I am reading czech version (different name)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Am I too late to learn programming?
    By maccat in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 02-17-2009, 07:49 AM
  2. Do you ever try to learn too much?
    By Stonehambey in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 06-17-2008, 07:55 AM
  3. Looking to learn C++
    By Fuzzy91 in forum C++ Programming
    Replies: 40
    Last Post: 04-13-2006, 02:38 AM
  4. Book for Newbie trying to learn C
    By uthscsa19 in forum C Programming
    Replies: 23
    Last Post: 12-24-2005, 10:02 AM
  5. Advice on how to being to learn C++
    By VenomUK in forum C++ Programming
    Replies: 9
    Last Post: 05-18-2002, 01:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21