Thread: How to use Vector's in C++ !?!

  1. #1
    Registered User IndioDoido's Avatar
    Join Date
    Apr 2007
    Posts
    194

    How to use Vector's in C++ !?!

    Hi,

    I'm learning C++ this year, and i have to work with vector's in my first project.

    Can anyone tel me were i can find sample codes using vectors and code references?

    In this project i have to use several vectors and "connect" there data.
    Exmp.:
    2 vectors:
    vector cars
    vector owners

    The same owner can have an unlimited number of cars, so those 2 vectors must be "connected".

    Can anyone help me where i can find good C++ vector examples?
    "Artificial Intelligence usually beats natural stupidity."

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,412
    Take a look at:
    cppreference.com's entry on vector
    SGI's STL reference on vector

    You could also read The C++ Standard Library: A Tutorial and Refence by Nicolai Josuttis.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User IndioDoido's Avatar
    Join Date
    Apr 2007
    Posts
    194
    hi laserlight, thanks alot!

    Im reading this book: "Thinking in C++ - Bruce Eckel", it's a bit boring but free :-)

    Is the book The C++ Standard Library in the same category, or is it more useful?
    In other words...should i buy it?
    "Artificial Intelligence usually beats natural stupidity."

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,412
    Is the book The C++ Standard Library in the same category, or is it more useful?
    Since it is a reference to the C++ standard library, it will be more useful in the long run. If you only want to use it as a tutorial and then use online references, I suggest borrowing it from your local library.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Vectors
    By naseerhaider in forum C++ Programming
    Replies: 11
    Last Post: 05-09-2008, 08:21 AM
  2. How can i made vectors measuring program in DevC++
    By flame82 in forum C Programming
    Replies: 1
    Last Post: 05-07-2008, 02:05 PM
  3. How properly get data out of vectors of templates?
    By 6tr6tr in forum C++ Programming
    Replies: 4
    Last Post: 04-15-2008, 10:35 AM
  4. Adding vectors ??
    By Hussain Hani in forum C++ Programming
    Replies: 1
    Last Post: 11-18-2006, 03:03 AM
  5. Points, vectors, matrices
    By subnet_rx in forum Game Programming
    Replies: 17
    Last Post: 01-11-2002, 02:29 PM