Stroustrup 5.9 exercise 11

A

arnuld

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 :)
 
G

Gary Wessle

arnuld said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top