Learning C++, more or less...

Discussion in 'C++' started by Rich Grise, Sep 3, 2004.

  1. Rich Grise

    Rich Grise Guest

    Well, since deciding I wanted to pursue this, it's only taken
    me three weeks or so to finally click my way to
    http://www.research.att.com/~bs/3rd.html .

    I'm getting the impression that the snippets from this book,
    and various on-line tutorials, of which so far 2/3 have been
    teaching C with C++ grammar, is the best I can do for free. :)

    I did find a good tutorial, though, that actually is about
    OOP in general, getting to C++ for his examples in about chap.
    6 or so:

    It's very enlightening - in a couple of weeks, I'll probably be able
    to understand the questions in the NG! :)

    Rich Grise, Sep 3, 2004
    1. Advertisements

  2. Rich Grise

    David Hilsee Guest

    Thinking in C++ (http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html)
    is another good free resource.
    David Hilsee, Sep 3, 2004
    1. Advertisements

  3. Rich Grise

    Rich Grise Guest

    Rich Grise, Sep 3, 2004
  4. Rich Grise

    Rich Grise Guest

    I've also been lurking, and following the thread about a 2D matrix with
    some interest. It seems to me that it's not a built-in concept - they do
    mention arrays, but so far it isn't clear if an ordinary array is a valid
    C++ construct, just for old times' sake or something, but a 2D array seems
    to be out of the question.

    Well, the 2D array I have in mind isn't the kind of thing that you could
    handle with any elegance as a vector, list, or map, that I can see, unless
    you would create a new class Array2D or something, which wouldn't be hard at
    all. The matrix I have in mind, of course, is something like you'd see on
    minesweeper or "the game of life." Static, and each element has a state.

    Maybe that's one of those times when an entirely nother language might
    be more appropriate, like APL or something. ;-)

    Then again, one of the tutorials is talking about point(), line(),
    rectangle(), circle(), and such - maybe they'll get to "plane" and define
    an XY array. I guess I'll find out! ;-)

    Rich Grise, Sep 3, 2004
  5. Rich Grise

    Mike Wahler Guest

    Sure it is. The syntax is the same as in C.

    int array[10];
    Not at all.

    int arr2[10][10];
    A vector is the container that models an array. One can
    indeed create a vector of vectors (of vectors, etc.).
    "Elegance" is in the eye of the beholder, so I won't go there.
    The 'state' of an array element would be its value.
    C++ can handle it just fine.
    const size_t X(10);
    const size_t Y(10);

    int array[X][Y];

    Mike Wahler, Sep 3, 2004
  6. Rich Grise

    jeffc Guest

    I think that either a vector of vectors or a map would do very nicely. A
    vector of vectors *is* a 2D array (abstractly speaking), and a map gives
    some additional niceties depending on what you're trying to do.
    jeffc, Sep 3, 2004
  7. Rich Grise

    puppet_sock Guest

    Hum. For free. Yes. Is your budget really so empty you can't afford
    even one book? I'd suggest you go get yourself a copy of Koenig and
    Moo _Accelerated C++_. They put your feet on the right path pretty
    early on in the game.
    puppet_sock, Sep 3, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.