Thread: Need help with an exercise from the book "C++ Primer"

  1. #1
    Registered User
    Join Date
    Aug 2010
    Posts
    2

    Need help with an exercise from the book "C++ Primer"

    The problem is stated as such:
    "Write a program that defines a vector of pointers to strings. Read the vector, printing each string and its corresponding size."

    I just want to know how I go would about setting such a vector up and filling it with strings.
    Thanks!

  2. #2
    Registered User antred's Avatar
    Join Date
    Apr 2012
    Location
    Germany
    Posts
    257
    I'm new to this forum myself, but in most forums Please-do-my-homework-for-me questions are frowned upon. You should at the very least show us your shot at solving your assignment. If you get stuck with a specific problem we'll be happy to help you, but you have to show some effort.

  3. #3
    Registered User
    Join Date
    Aug 2010
    Posts
    2
    Quote Originally Posted by antred View Post
    I'm new to this forum myself, but in most forums Please-do-my-homework-for-me questions are frowned upon. You should at the very least show us your shot at solving your assignment. If you get stuck with a specific problem we'll be happy to help you, but you have to show some effort.
    You're right, I should have given the problem my attention because I got the answer I was looking for.
    Thanks!

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > You're right, I should have given the problem my attention because I got the answer I was looking for.
    And in only 20 minutes - impressive.

    Did it look like Exercise 5.18:
    Write a program that defines a vector of pointers to strings. Read the vector, printing each string and its corresponding size.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Exercise solutions from "Accelerated C++" (Koenig/Moo)
    By tap3ah in forum C++ Programming
    Replies: 20
    Last Post: 04-04-2012, 06:59 AM
  2. Replies: 1
    Last Post: 11-16-2007, 08:31 PM
  3. "itoa"-"_itoa" , "inp"-"_inp", Why some functions have "
    By L.O.K. in forum Windows Programming
    Replies: 5
    Last Post: 12-08-2002, 08:25 AM
  4. "CWnd"-"HWnd","CBitmap"-"HBitmap"...., What is mean by "
    By L.O.K. in forum Windows Programming
    Replies: 2
    Last Post: 12-04-2002, 07:59 AM
  5. Write and read the book called "registry""
    By CodeMonkey in forum Windows Programming
    Replies: 4
    Last Post: 03-10-2002, 10:45 AM