
-----------------------------------
Viper
Thu Sep 08, 2005 8:43 am

name thing
-----------------------------------
A list of names is entered ending with the sentinel name "zzzz".  Output each of the names not including the sentinel. 
i cant have it not put the sentinel

-----------------------------------
Flikerator
Thu Sep 08, 2005 10:29 am

Re: name thing
-----------------------------------
A list of names is entered ending with the sentinel name "zzzz".  Output each of the names not including the sentinel. 
i cant have it not put the sentinel

All you have to do is is before you put the name, detect the "zzzz".

Depending on how you did it...

exit when name = "zzzz"
put name


(You in Mr.Cs class? Lolz )

-----------------------------------
Viper
Fri Sep 09, 2005 8:04 am


-----------------------------------
tht dont work bc when they enter the name it puts it on the screen

-----------------------------------
Flikerator
Fri Sep 09, 2005 10:15 am


-----------------------------------
Mind posting the code? It would be a lot easier to help you then.

-----------------------------------
beard0
Sun Sep 11, 2005 5:11 pm


-----------------------------------
View.Set ("noecho")

-----------------------------------
Token
Sun Sep 11, 2005 5:28 pm


-----------------------------------
I dont think I understand the question, what do you mean by a sentinel? For some odd reason it comes to mind entering passwords when all you get is *** is that what we're trying to do here? I bet I'm completely off.

-----------------------------------
beard0
Sun Sep 11, 2005 5:37 pm


-----------------------------------
The sentinel is the name being given to the string "zzzz"
...ending with the sentinel name "zzzz".
He need's to output all names except the sentinel, and so far has only managed to "output" every single name, by which I think he actually means that he let turing display them as he input them.  What I was saying he should do is use View.Set("noecho") to surpress the display of input, and then actually output only those names that are not "zzzz."

-----------------------------------
[Gandalf]
Sun Sep 11, 2005 5:41 pm


-----------------------------------
The difficulty in that is that then you don't see what you are typing.  There is no way to see what you are typing, and not see when you type zzzz unless you want to ignore all z's or something?

Anyway, since I wanted to...
View.Set ("noecho")
var name : flexible array 1 .. 0 of string
var cnt : int := 0

loop
    cnt += 1
    new name, upper (name) + 1
    get name (cnt)
    exit when name (cnt) = "zzzz"
    put name (cnt)
end loop
put "Finished"

Or a simplified version which doesn't store the names:
View.Set ("noecho")
var name : string

loop
    get name
    exit when name = "zzzz"
    put name
end loop
put "Finished"

-----------------------------------
beard0
Sun Sep 11, 2005 5:50 pm


-----------------------------------
Okay, Gandalf

You can see what you type now:

var name : flexible array 1 .. 0 of string
loop
    new name, upper (name) + 1
    get name (upper (name))
    exit when name (upper (name)) = "zzzz"
end loop
new name, upper (name) - 1
cls
for i : 1 .. upper (name)
    put name (i)
end for

P.S.  Why the cnt?

-----------------------------------
[Gandalf]
Sun Sep 11, 2005 6:05 pm


-----------------------------------
Oops :oops:, it's not necessary, you're right.

I thought the problem was that the user shouldn't be able to see even when he is typing the zzzz.  This would require the program to probably guess that when z is pressed it shouldn't output the name, which has quite a few problems.

-----------------------------------
beard0
Sun Sep 11, 2005 6:14 pm


-----------------------------------
If you wanted to get really fancy, you could use getch, and output anything that could not be "zzzz" (ie, supress "z", but then if the user continues with "a", output "za" and everything that follows).
