About Standard Template Library

Discussion in 'C++' started by r3694117@gmail.com, Oct 23, 2006.

  1. Guest

    i am a kookie in C++ ,and don't understand many things like following
    example.

    Write a function template palindrome that takes a vector parameter and
    returns TRue or false according to whether the vector does or does not
    read the same forward as backward .

    can someone help me?thx!!
     
    , Oct 23, 2006
    #1
    1. Advertising

  2. loufoque Guest

    wrote:

    > Write a function template palindrome that takes a vector parameter and
    > returns TRue or false according to whether the vector does or does not
    > read the same forward as backward .


    We don't do homework.
    As this is trivial, the answer is probably in your book or lessons.
     
    loufoque, Oct 23, 2006
    #2
    1. Advertising

  3. Daniel T. Guest

    "" <> wrote:

    > i am a kookie in C++ ,and don't understand many things like following
    > example.
    >
    > Write a function template palindrome that takes a vector parameter and
    > returns TRue or false according to whether the vector does or does not
    > read the same forward as backward .


    Kind of an odd request. I would expect such a function to take a
    basic_string, not a vector.

    --
    To send me email, put "sheltie" in the subject.
     
    Daniel T., Oct 23, 2006
    #3
  4. Noah Roberts Guest

    Daniel T. wrote:
    > "" <> wrote:
    >
    > > i am a kookie in C++ ,and don't understand many things like following
    > > example.
    > >
    > > Write a function template palindrome that takes a vector parameter and
    > > returns TRue or false according to whether the vector does or does not
    > > read the same forward as backward .

    >
    > Kind of an odd request. I would expect such a function to take a
    > basic_string, not a vector.
    >


    Or two iterators.
     
    Noah Roberts, Oct 23, 2006
    #4
  5. Daniel T. wrote:
    > "" <> wrote:
    >
    >> i am a kookie in C++ ,and don't understand many things like following
    >> example.
    >>
    >> Write a function template palindrome that takes a vector parameter
    >> and returns TRue or false according to whether the vector does or
    >> does not read the same forward as backward .

    >
    > Kind of an odd request. I would expect such a function to take a
    > basic_string, not a vector.


    I would probably expect it to take two iterators, which would make it
    possible to be used with any standard containers, basic_string included.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
     
    Victor Bazarov, Oct 23, 2006
    #5
  6. Daniel T. Guest

    "Victor Bazarov" <> wrote:
    > Daniel T. wrote:
    > > "" <> wrote:
    > >
    > >> i am a kookie in C++ ,and don't understand many things like following
    > >> example.
    > >>
    > >> Write a function template palindrome that takes a vector parameter
    > >> and returns TRue or false according to whether the vector does or
    > >> does not read the same forward as backward .

    > >
    > > Kind of an odd request. I would expect such a function to take a
    > > basic_string, not a vector.

    >
    > I would probably expect it to take two iterators, which would make it
    > possible to be used with any standard containers, basic_string included.


    Noah said the same thing. Two bi-directional iterators? That makes
    sense; the string might contain more than one word and using iterators
    would allow one to isolate each word.

    --
    To send me email, put "sheltie" in the subject.
     
    Daniel T., Oct 23, 2006
    #6
  7. osmium Guest

    "Daniel T." writes:

    >> i am a kookie in C++ ,and don't understand many things like following
    >> example.
    >>
    >> Write a function template palindrome that takes a vector parameter and
    >> returns TRue or false according to whether the vector does or does not
    >> read the same forward as backward .

    >
    > Kind of an odd request. I would expect such a function to take a
    > basic_string, not a vector.


    The first thing to do when confronted with some odd sounding request such as
    this is to belabor the word defintions. From the first hit on <define:
    palindrome> on google:

    "A sequence that reads the same in either direction;
    in genetics, refers to an enzyme recognition sequence
    that reads the same on both strands of DNA."
     
    osmium, Oct 23, 2006
    #7
  8. Zara Guest

    On Mon, 23 Oct 2006 12:41:21 -0700, "osmium" <>
    wrote:

    >"Daniel T." writes:
    >
    >>> i am a kookie in C++ ,and don't understand many things like following
    >>> example.
    >>>
    >>> Write a function template palindrome

    <snip>
    >
    >The first thing to do when confronted with some odd sounding request such as
    >this is to belabor the word defintions. From the first hit on <define:
    >palindrome> on google:
    >
    > "A sequence that reads the same in either direction;
    > in genetics, refers to an enzyme recognition sequence
    > that reads the same on both strands of DNA."
    >
    >


    Hey, what about "being a kookie"? Does it mean OP is sweet and edible?

    Zara
     
    Zara, Oct 24, 2006
    #8
  9. Zara wrote:
    > On Mon, 23 Oct 2006 12:41:21 -0700, "osmium" <>
    > wrote:
    >
    >> "Daniel T." writes:
    >>
    >>>> i am a kookie in C++ ,and don't understand many things like
    >>>> following example.
    >>>>
    >>>> Write a function template palindrome

    > <snip>
    >>
    >> The first thing to do when confronted with some odd sounding request
    >> such as this is to belabor the word defintions. From the first hit
    >> on <define: palindrome> on google:
    >>
    >> "A sequence that reads the same in either direction;
    >> in genetics, refers to an enzyme recognition sequence
    >> that reads the same on both strands of DNA."
    >>
    >>

    >
    > Hey, what about "being a kookie"? Does it mean OP is sweet and edible?


    I think it's a variation of "a kook" and not of "a cookie".

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
     
    Victor Bazarov, Oct 24, 2006
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fredrik Lundh
    Replies:
    0
    Views:
    434
    Fredrik Lundh
    Feb 4, 2005
  2. Daniel Bickett
    Replies:
    0
    Views:
    383
    Daniel Bickett
    Feb 4, 2005
  3. steve.leach

    How standard is the standard library?

    steve.leach, Apr 18, 2005, in forum: Python
    Replies:
    1
    Views:
    394
    Christos TZOTZIOY Georgiou
    Apr 18, 2005
  4. funkyj
    Replies:
    5
    Views:
    1,133
    funkyj
    Jan 20, 2006
  5. Carmen Sei
    Replies:
    4
    Views:
    847
    James Kanze
    Mar 5, 2008
Loading...

Share This Page