Stroustrup 5.9 exercise 11

Discussion in 'C++' started by arnuld, Nov 9, 2006.

  1. arnuld

    arnuld Guest

    hai,

    its me again ;-)

    problem: read a sequence of words from input. use /quit/ as a word
    that terminates the input.
    1.) print the words in the order they were entered. dont print a word
    twice.
    2.) modify the programme to sort the words before printing the.

    actually i did not undertsand what exactly Stroustrup is talking about.
    based on my understanding of the problem i think for 1st point he wants
    the following to happen when programme runs:
    ---------------------------------------------------------------------
    [arnuld@localhost cpp]$ ./a.out
    we
    are
    the
    champions
    quit
    -------- writing input --------
    we
    are
    the
    champions
    [arnuld@localhost cpp]$
    -------------------------------------------------------------------------



    & for 2nd point he wants:

    -----------------------------------------------------------------------
    [arnuld@localhost cpp]$ ./a.out
    we
    are
    the
    champions
    quit
    -------- writing input --------
    are
    champions
    the
    we
    [arnuld@localhost cpp]$
    -----------------------------------------------------------------------


    am i right? or he wants the "sequence of words" in one single line?
    (actually i wrote the code that produced the previous 2 outputs, i am
    writing C++ programmes :)
     
    arnuld, Nov 9, 2006
    #1
    1. Advertising

  2. arnuld

    Gary Wessle Guest

    "arnuld" <> writes:

    > hai,
    >
    > its me again ;-)
    >
    > problem: read a sequence of words from input. use /quit/ as a word
    > that terminates the input.
    > 1.) print the words in the order they were entered. dont print a word
    > twice.
    > 2.) modify the programme to sort the words before printing the.
    >
    > actually i did not undertsand what exactly Stroustrup is talking about.
    > based on my understanding of the problem i think for 1st point he wants
    > the following to happen when programme runs:
    > ---------------------------------------------------------------------
    > [arnuld@localhost cpp]$ ./a.out
    > we
    > are
    > the
    > champions
    > quit
    > -------- writing input --------
    > we
    > are
    > the
    > champions
    > [arnuld@localhost cpp]$
    > -------------------------------------------------------------------------
    >
    >
    >
    > & for 2nd point he wants:
    >
    > -----------------------------------------------------------------------
    > [arnuld@localhost cpp]$ ./a.out
    > we
    > are
    > the
    > champions
    > quit
    > -------- writing input --------
    > are
    > champions
    > the
    > we
    > [arnuld@localhost cpp]$
    > -----------------------------------------------------------------------
    >
    >
    > am i right? or he wants the "sequence of words" in one single line?
    > (actually i wrote the code that produced the previous 2 outputs, i am
    > writing C++ programmes :)


    looks good to me.
     
    Gary Wessle, Nov 9, 2006
    #2
    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. arnuld

    Stroustrup 5.9 exercise 6

    arnuld, Nov 8, 2006, in forum: C++
    Replies:
    7
    Views:
    386
    arnuld
    Nov 8, 2006
  2. arnuld
    Replies:
    5
    Views:
    369
    Alf P. Steinbach
    Nov 8, 2006
  3. arnuld
    Replies:
    2
    Views:
    317
    arnuld
    Nov 8, 2006
  4. arnuld
    Replies:
    6
    Views:
    400
    arnuld
    Nov 8, 2006
  5. arnuld

    Stroustrup 5.9 exercise 9

    arnuld, Nov 8, 2006, in forum: C++
    Replies:
    5
    Views:
    425
    Bernd Strieder
    Nov 9, 2006
Loading...

Share This Page