Starting young.

This is a discussion on Starting young. within the C++ Programming forums, part of the General Programming Boards category; Just thought I'd mention that as somebody who has been trying to learn C++ for a couple of months I ...

  1. #16
    Registered User
    Join Date
    Sep 2007
    Posts
    127
    Just thought I'd mention that as somebody who has been trying to learn C++ for a couple of months I think sticking with it is a big problem whichever language you use. I started learning a few years ago, then stopped, and now I'm trying again. It's really easy to get discouraged and sidetracked when you're starting out.

    Seems to me like learning to program when you're young is a good idea though, generally. When you leave school there are a lot more soul-destroying jobs out there than programming. Even more depressing, it's not like those soul-destroying jobs actually benefit anyone apart from cynical management bots anyway..

  2. #17
    Registered User
    Join Date
    Nov 2006
    Posts
    519
    you really want to read this from the lead designer of civilisation:

    http://www.designer-notes.com/?p=62

    For games you'll have to learn C++. I can't imagine any company out there witch uses anything else (except for scripted game logic, so you can add lua and or python, but C++ first).

    Programming will also not be your biggest concern. As a game developer your biggest concern will be math. While 8 hours working you'll about 5 hours thinking about math, 0.5 hours about girls, 1 hour browsing the web, 0.5 hours cooking coffee and 1 hour programming.
    Last edited by pheres; 11-28-2007 at 01:20 AM.

  3. #18
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,341
    As the saying goes, hours spent thinking about the design can save months of coding effort.
    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. #19
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    Quote Originally Posted by Salem View Post
    As the saying goes, hours spent thinking about the design can save months of coding effort.
    Yes, indeed. I've found personally that delaying actually coding something in order to sort out the design actually does help, even for very small test programs. And the benefit is that you don't have to be actually sitting at your computer all the time to actually think of these kind of things (but that doesn't stop most of us from sitting at a computer 24 hours, right? )

    Basically put, know what you're doing before you sit down to actually write code. Wholeheartedly agreed.

  5. #20
    Registered User
    Join Date
    Nov 2006
    Posts
    519
    The best and most elegant ideas about design I had came to me being far away from my computer. Computers seem to somehow break any creativity in me

  6. #21
    Registered User
    Join Date
    Nov 2007
    Posts
    40
    Well I've decided that I do want to jump right into C++, but that's such an overwhelming task that I don't know where to start...

    I've seen plenty of books and online tutorials on learning C++, but they pretty much just tell you what to write to get the outcome, not why you get that outcome. I have an infinitely easier time remembering things if I know how they work.

    So I think it'd be much much easier for me to get into it if I learned by doing, not reading endless pages on how to do it.

  7. #22
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Learning by doing is a good way.

    You need to find a book that gives you decent excercises. And I mean a book, not a web-site. Most web-tutorials are much briefer than a proper book.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  8. #23
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    You need a balance between the two. Writing random garbage isn't going to teach you much except how to get frustrated. Reading too many tutorials without experience won't let the knowledge stick.

    A basic way to learn:

    1. Read a tutorial.
    2. Type/copy the example code and run it.
    3. Try altering the code and predicting the results of something you think is obvious. If it works, you might actually understand it.


    After you have a few of the basics handled, do some practice programs that take advantage of what you already know.

  9. #24
    Registered User
    Join Date
    Nov 2006
    Posts
    519
    Assign yourself little problems and than find out how to solve them by reading. Maybe start with a little console program reading input given by the user and put something out. Every tutorial or book will help you. But better watch out to get material which really cares about (actual) C++ .

    Than go on and do a little processing between in- and output. Model the logic of the paper, stone, scissor game. It's very easy and you'll have already your first game. Than go on from there and assign yourself some improvements...

  10. #25
    Registered User
    Join Date
    Nov 2007
    Posts
    40
    Yeah lol, trying to learn from online tutorials is like trying to build a house out of legos with a two-page long manual.

    I'll try some more of the example code-altering, thanks.

    And I also think that I'll get a book or two for the examples and knowledge.

    This'll bring some meaning to the countless hours I spend at my computer :P.

  11. #26
    Registered User Ktulu's Avatar
    Join Date
    Oct 2006
    Posts
    62
    C -> C++ -> OpenGL / DirectX.
    This parameter is reserved

  12. #27
    Registered User
    Join Date
    Nov 2007
    Posts
    40
    I'm trying to write an extremely simple program, but I can't figure out how to loop back to a certain point... This is what I have:

    Code:
     #include <iostream>
    
    using namespace std;
    
    
       int main()
    {
        int a; {
    
        cout<<"Please type a number that is less than 5: \n";
        cin>> a;
        cin.ignore();
    
        }
        if ( a < 5 ) {
            cout<<"Correct!\n";
            cin.get();
    
        }
        else if ( a > 5 ) {
            cout<<"Incorrect, try again...\n";
    
            return main();
        }
        else {
            cout<<"I said LESS THAN 5... Try again.\n";
    
            return main();
        }
                                         //I only want it to loop back to here, instead of back to the beginning...
        int b; {
        cout<<"Please solve this equation for variable Y: y=2x3+7 \n";
        cin>> b;
        cin.ignore();
    
        }
        if ( b == 13 ) {
            cout<<"Correct!\n";
            cin.get();
    
        }
        else if ( b > 13 ) {
            cout<<"Nope, Try again...\n";
    
            return main();                 //This is where I would want it to stop and go back
        } 
        else ( b < 13 ); {
            cout<<"Nope, Try again...\n";
    
            return main();                 //This is also where I would want it to stop and go back
        }

  13. #28
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,180
    Use
    Code:
    for(;;)
    and
    Code:
    continue
    And if you don't want it to loop anymore, use
    Code:
    break
    And don't do return main. Use a loop instead.

  14. #29
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    20,976
    In this case you do not actually need the continue, two controlled infinite loops with an appropriate break will do.

    I suggest getting rid of superfluous braces and fixing your indentation. For example, you do not need the braces around:
    Code:
        int a; {
    
        cout<<"Please type a number that is less than 5: \n";
        cin>> a;
        cin.ignore();
    
        }
    While debugging, you might also discover an interesting typo error on this line:
    Code:
        else ( b < 13 ); {
    In fact, since you are printing the exact same statement for both the b < 13 and b > 13 cases, you do not need them at all. A simple else will do.
    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

  15. #30
    Registered User
    Join Date
    Nov 2007
    Posts
    40
    It makes sense to use a "for" loop, but I don't understand how to set one up in this situation...

    EDIT: Oh laserlight, I didn't know I could put them both in one line, that saves some useless code :P Thanks a lot
    Last edited by PAragonxd; 11-29-2007 at 04:20 AM.

Page 2 of 3 FirstFirst 123 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Starting programs
    By Molokai in forum C Programming
    Replies: 1
    Last Post: 04-16-2009, 10:10 AM
  2. Interpreter.c
    By moussa in forum C Programming
    Replies: 4
    Last Post: 05-28-2008, 05:59 PM
  3. i am not able to figure ot the starting point of this
    By youngashish in forum C++ Programming
    Replies: 7
    Last Post: 10-07-2004, 02:41 AM
  4. question about reading inputs starting with 0
    By jibbles in forum C Programming
    Replies: 8
    Last Post: 08-09-2004, 03:27 AM
  5. we of the cage
    By mithrandir in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 08-21-2002, 10:14 AM

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