beginer

Discussion in 'C++' started by Darko Lapanje, Sep 9, 2003.

  1. how can I write program who removes all ' ' from the string?

    dl
     
    Darko Lapanje, Sep 9, 2003
    #1
    1. Advertising

  2. On Tue, 9 Sep 2003 15:52:16 +0200, "Darko Lapanje" <> wrote:

    >how can I write program who removes all ' ' from the string?


    There are ways that for an experienced programmer would be easier,
    but as a novice, translate to C++:


    1) Obtain string s from e.g. program arguments or user, or
    simply set it to a well-known test value like "steak brandy cigar".

    2) Set string t to empty.

    3) For each character position i in s, in ascending order:
    {
    Let c be character number i in s.
    If c is different from a space, then
    {
    Append c to the end of t.
    }
    }
     
    Alf P. Steinbach, Sep 9, 2003
    #2
    1. Advertising

  3. "Darko Lapanje" <> wrote in message
    news:bjkm2b$ocb$...
    > how can I write program who removes all ' ' from the string?


    There was actually a thread about this a couple of weeks ago:

    http://tinyurl.com/mqge

    Regards,

    Russell Hanneken
     
    Russell Hanneken, Sep 9, 2003
    #3
  4. "Darko Lapanje" <> wrote in message
    news:bjkm2b$ocb$...
    > how can I write program who removes all ' ' from the string?
    >
    > dl


    s.erase(std::remove_if(s.begin(), s.end(),
    std::bind2nd(std::equal_to<char>(), ' ')), s.end());

    HTH,

    Stuart.
     
    Stuart Golodetz, Sep 9, 2003
    #4
    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. My and I

    Beginer need helppp!!

    My and I, Aug 24, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    500
    clintonG
    Aug 24, 2004
  2. Lloyd Dupont

    dummy beginer's question

    Lloyd Dupont, Nov 20, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    465
    clintonG
    Nov 21, 2005
  3. ArMa

    Beginer question

    ArMa, Apr 13, 2005, in forum: Java
    Replies:
    0
    Views:
    498
  4. vee_kay
    Replies:
    7
    Views:
    410
  5. Mario Krsnic

    beginer in ASP - how to implement counter

    Mario Krsnic, Jun 18, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    2,550
    Juan T. Llibre
    Jun 18, 2006
Loading...

Share This Page