Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #76655

Re: While or if: function to get next operator or operand

From Richard Heathfield <rjh@cpax.org.uk>
Newsgroups comp.lang.c
Subject Re: While or if: function to get next operator or operand
Date 2015-11-20 17:39 +0000
Organization A noiseless patient Spider
Message-ID <n2nloh$6gu$1@dont-email.me> (permalink)
References <ca6f25b9-c067-4945-b4dd-2ba0a97ec136@googlegroups.com> <n2nibm$n2h$1@dont-email.me> <8b49cc13-fc55-470d-8941-02ba737e3257@googlegroups.com>

Show all headers | View raw


On 20/11/15 17:11, Alla _ wrote:

<snip>

> I have not skipped through pages. The only thing I have been doing
> during the last three days is reading and studying K&R.

I was a touch harsh, for which I apologise. But you are still going way 
too fast. You are trying to absorb new material without having a firm 
foundation in what has gone before.

To demonstrate this, I would like to offer you a little challenge if I 
may. (No doubt other people will also chip in their own answers, but I 
would urge you to ignore those answers until you have come up with your 
own solution.)

Here's the challenge:

Write a correct C program that reads standard input and reproduces it on 
standard output verbatim *except that* each word (which I define as a 
contiguous series of letters terminated on each end by a non-letter or 
by one end or other of the input) is displayed with the inner letters 
(i.e. not the first and last letters) sorted into alphabetical order. 
The first and last letters should stay in their correct positions. I 
will now demonstrate what I mean, using this paragraph as input.

Wirte a cceorrt C pagorrm taht rades saadnrtd input and rcdeeoprus it on 
saadnrtd optuut vabeirtm *ecepxt taht* each word (wchih I define as a 
cginootuus seeirs of leettrs taeeimnrtd on each end by a non-leettr or 
by one end or oehtr of the input) is daeilpsyd with the iennr leettrs 
(i.e. not the first and last leertts) seortd into aaabcehilptl oderr. 
The first and last leertts shloud saty in tehir cceorrt piinoosts. I 
will now daemnorstte waht I maen, uinsg this paaagprrh as input.

You may assume that no word exceeds 64 letters in length.

If you have absorbed everything you have read in K&R up to page 77, this 
will be a very easy exercise, and you will not need any help with it.

So if you struggle with it (and I think you will), that is a sign that 
you are going too fast.

-- 
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

While or if: function to get next operator or operand Alla _ <modelling.data@gmail.com> - 2015-11-20 08:06 -0800
  Re: While or if: function to get next operator or operand Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-20 08:17 -0800
    Re: While or if: function to get next operator or operand Richard Heathfield <rjh@cpax.org.uk> - 2015-11-20 16:44 +0000
  Re: While or if: function to get next operator or operand Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-11-20 11:23 -0500
    Re: While or if: function to get next operator or operand Alla _ <modelling.data@gmail.com> - 2015-11-20 08:39 -0800
      Re: While or if: function to get next operator or operand Richard Heathfield <rjh@cpax.org.uk> - 2015-11-20 16:47 +0000
      Re: While or if: function to get next operator or operand Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-11-20 11:54 -0500
        Re: While or if: function to get next operator or operand Alla _ <modelling.data@gmail.com> - 2015-11-20 09:13 -0800
        Re: While or if: function to get next operator or operand David Thompson <dave.thompson2@verizon.net> - 2015-12-06 08:04 -0500
      Re: While or if: function to get next operator or operand James Kuyper <jameskuyper@verizon.net> - 2015-11-20 12:02 -0500
  Re: While or if: function to get next operator or operand Richard Heathfield <rjh@cpax.org.uk> - 2015-11-20 16:41 +0000
    Re: While or if: function to get next operator or operand Alla _ <modelling.data@gmail.com> - 2015-11-20 09:11 -0800
      Re: While or if: function to get next operator or operand Richard Heathfield <rjh@cpax.org.uk> - 2015-11-20 17:39 +0000
        Re: While or if: function to get next operator or operand Alla _ <modelling.data@gmail.com> - 2015-11-20 10:42 -0800
        Re: While or if: function to get next operator or operand Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-11-21 14:58 -0500
          Re: While or if: function to get next operator or operand Richard Heathfield <rjh@cpax.org.uk> - 2015-11-23 12:21 +0000
        Re: While or if: function to get next operator or operand Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-21 21:29 +0000
          Re: While or if: function to get next operator or operand BartC <bc@freeuk.com> - 2015-11-21 22:31 +0000
            Re: While or if: function to get next operator or operand BartC <bc@freeuk.com> - 2015-11-22 10:57 +0000
              Re: While or if: function to get next operator or operand Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-22 13:45 +0000
          Re: While or if: function to get next operator or operand Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-11-22 01:31 -0500
          Re: While or if: function to get next operator or operand Tim Rentsch <txr@alumni.caltech.edu> - 2015-11-23 04:33 -0800
            Re: While or if: function to get next operator or operand Philip Lantz <prl@canterey.us> - 2015-11-23 23:44 -0800
        Re: While or if: function to get next operator or operand Rosario19 <Ros@invalid.invalid> - 2015-11-22 09:39 +0100
          Re: While or if: function to get next operator or operand Rosario19 <Ros@invalid.invalid> - 2015-11-22 09:49 +0100
            Re: While or if: function to get next operator or operand asetofsymbols@gmail.com - 2015-11-22 02:27 -0800
              Re: While or if: function to get next operator or operand asetofsymbols@gmail.com - 2015-11-22 02:32 -0800
        Re: While or if: function to get next operator or operand Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-11-22 10:02 -0500
          Re: While or if: function to get next operator or operand Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-23 17:23 +0000
            Re: While or if: function to get next operator or operand Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-11-23 12:31 -0500
              Re: While or if: function to get next operator or operand Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-11-23 13:02 -0500
        Re: While or if: function to get next operator or operand Alla _ <modelling.data@gmail.com> - 2015-11-22 07:06 -0800
          Re: While or if: function to get next operator or operand Barry Schwarz <schwarzb@dqel.com> - 2015-11-22 11:43 -0800
            Re: While or if: function to get next operator or operand Alla _ <modelling.data@gmail.com> - 2015-11-24 02:03 -0800
            Re: While or if: function to get next operator or operand Alla _ <modelling.data@gmail.com> - 2015-11-24 02:11 -0800
              Re: While or if: function to get next operator or operand James Kuyper <jameskuyper@verizon.net> - 2015-11-24 07:09 -0500
          Re: While or if: function to get next operator or operand Richard Heathfield <rjh@cpax.org.uk> - 2015-11-23 12:26 +0000
            Re: While or if: function to get next operator or operand raltbos@xs4all.nl (Richard Bos) - 2015-11-23 13:26 +0000
        Re: While or if: function to get next operator or operand Alla _ <modelling.data@gmail.com> - 2015-11-22 07:17 -0800
  Re: While or if: function to get next operator or operand James Kuyper <jameskuyper@verizon.net> - 2015-11-20 12:15 -0500
    Re: While or if: function to get next operator or operand Alla _ <modelling.data@gmail.com> - 2015-11-20 10:44 -0800
    Re: While or if: function to get next operator or operand Tim Rentsch <txr@alumni.caltech.edu> - 2015-11-20 12:31 -0800
      Re: While or if: function to get next operator or operand Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-11-20 15:38 -0500
        Re: While or if: function to get next operator or operand James Kuyper <jameskuyper@verizon.net> - 2015-11-20 16:14 -0500
          Re: While or if: function to get next operator or operand Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-11-20 16:55 -0500
            Re: While or if: function to get next operator or operand Geoff <geoff@invalid.invalid> - 2015-11-20 15:04 -0800
        Re: While or if: function to get next operator or operand Barry Schwarz <schwarzb@dqel.com> - 2015-11-20 20:59 -0800
        Re: While or if: function to get next operator or operand Alla _ <modelling.data@gmail.com> - 2015-11-20 23:50 -0800
          Re: While or if: function to get next operator or operand Alla _ <modelling.data@gmail.com> - 2015-11-21 00:18 -0800
        Re: While or if: function to get next operator or operand Tim Rentsch <txr@alumni.caltech.edu> - 2015-11-22 14:10 -0800
      Re: While or if: function to get next operator or operand Philip Lantz <prl@canterey.us> - 2015-11-22 19:00 -0800
        Re: While or if: function to get next operator or operand James Kuyper <jameskuyper@verizon.net> - 2015-11-23 06:57 -0500
          Re: While or if: function to get next operator or operand Philip Lantz <prl@canterey.us> - 2015-11-23 23:49 -0800
            Re: While or if: function to get next operator or operand James Kuyper <jameskuyper@verizon.net> - 2015-11-24 07:13 -0500
        Re: While or if: function to get next operator or operand Tim Rentsch <txr@alumni.caltech.edu> - 2015-11-23 07:55 -0800
          Re: While or if: function to get next operator or operand Philip Lantz <prl@canterey.us> - 2015-11-23 23:36 -0800
            Re: While or if: function to get next operator or operand Tim Rentsch <txr@alumni.caltech.edu> - 2015-11-27 13:32 -0800
    Re: While or if: function to get next operator or operand Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-11-20 16:13 -0500
      Re: While or if: function to get next operator or operand Tim Rentsch <txr@alumni.caltech.edu> - 2015-11-22 13:54 -0800
  Re: While or if: function to get next operator or operand Geoff <geoff@invalid.invalid> - 2015-11-20 12:19 -0800
  Re: While or if: function to get next operator or operand Tim Rentsch <txr@alumni.caltech.edu> - 2015-11-20 15:32 -0800
    Re: While or if: function to get next operator or operand Chad <cdalten@gmail.com> - 2015-11-20 18:38 -0800
      Re: While or if: function to get next operator or operand Keith Thompson <kst-u@mib.org> - 2015-11-20 19:45 -0800
        Re: While or if: function to get next operator or operand Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-20 20:12 -0800
      Re: While or if: function to get next operator or operand Alla _ <modelling.data@gmail.com> - 2015-11-20 20:45 -0800
        Re: While or if: function to get next operator or operand Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-20 21:04 -0800
      Re: While or if: function to get next operator or operand Tim Rentsch <txr@alumni.caltech.edu> - 2015-11-22 13:57 -0800
    Re: While or if: function to get next operator or operand Alla _ <modelling.data@gmail.com> - 2015-11-20 20:43 -0800

csiph-web