Re: Find 3: The Reckoning

new topic     » goto parent     » topic index » view thread      » older message » newer message

Thomas,
you really must start reading the manuals. The answer has been given to you,
both by me and Al. All you have to do is read and understand. Nobody wants
to do all the work for you. You have to put in some effort too!

You say that you are trying to find out the position of the character the
user typed, in the names. But which name Thomas? Any name? The random name?

You haven't expressed your requirement clearly enough. There is still lots
of ambiguity.

So here's my guess at what you are trying to do.
--------------------------------
The user can type in anything but we only use the first character. The
program then has to find out if a random name contains whatever character
the user entered.
--------------------------------

Here is your code with changes by myself.

include get.e
-----------------------
include wildcard.e  -- for the lower() function
-----------------------
sequence names,curname
object input
integer location
atom wn
wn=rand(3)
names ={"bob","them","worms"}
curname=names[wn]
printf(1,"curname: %s\n",{curname})

input=gets(0)
? curname
puts(1,"\n")
? input

--------------DEREK's CODE-------------
location = find(lower(input[1]), curname)
-------------------------------------

puts(1,"\n")
? location

-----
cheers,
Derek Parnell

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu