Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!dsl.pitt.edu!pitt!willett!ForthNet From: ForthNet@willett.pgh.pa.us (ForthNet articles from GEnie) Newsgroups: comp.lang.forth Subject: PUZZLES AND PROBLEMS Message-ID: <1538.UUL1.3#5129@willett.pgh.pa.us> Date: 16 Aug 90 11:47:41 GMT Organization: String, Scotch tape, and Paperclips. (in Pgh, PA) Lines: 25 Category 3, Topic 35 Message 135 Wed Aug 15, 1990 D.RUFFER [Dennis] at 23:18 EDT Re: GORDON GANDERTON > 3. Write a program that repeatedly calculates how many chars > separate two letters typed in by the user, until terminated with > ctlC. For instance there are 2 characters ('b' and 'c') between > 'a' and 'd'. Take advantage of the fact that the arithmetic > operators work on character variables just as well as they do on > numbers. Rgds. I don't understand the question Gordon. What letters are typed in by the user, the 'a' and 'd' or the characters in between, and what gets terminated by ctlC? If I know what the deliminating characters are and I have gotten the string into memory, then the problem is simply searching from the start of the string for the left deliminator and from the end of the string for the right one. Then you simply subtract the addresses. That part seems trivial, but I'm confused about where the string and deliminators come from. DaR ----- This message came from GEnie via willett through a semi-automated process. Report problems to: uunet!willett!dwp or dwp@willett.pgh.pa.us