Computer Science Canada GR 11 turing help |
Author: | RyanHB [ Mon May 04, 2009 5:03 pm ] |
Post subject: | GR 11 turing help |
It's a simple problem, but im new to turing. I've focused mainly on java and C++. But heres the problem.. Im basically just entereing peoples names and weights in and listing them on a chart at the same time. Its divided into three categories. So the question is how do i clear the space where the user enters the name and weight without clearing the actual chart? Variables: name : For the individuals name Weight: For his/her weight middw: Middle weight heavw: Heavy weight lightw: Light weight.. but yeah, if someone could just tell me that one line of code or so to clear the text area |
Author: | saltpro15 [ Mon May 04, 2009 5:26 pm ] |
Post subject: | RE:GR 11 turing help |
name := "" Weight := 0 edit : that name :="" is " " sans space, not '''' 4 apostrophe's |
Author: | RyanHB [ Mon May 04, 2009 5:48 pm ] |
Post subject: | RE:GR 11 turing help |
Oh yeah, I guess I should mention That the user must enter 10 names and 10 weights, so i have to stop this from going down the screen. name: weight: name: weight: name: weight: name: weight: etc.. and interfering with the chart I need it only to display the chart I don't think the array would work for that, but im not sure, ill try it. What I am currently using is a loop.. I used loop put "Enter Name: ".. get Name numname:=numname+1 put "Enter Weight: ".. get Weight then I have a few if statements selecting where to put the names on the chart.. exit when numname:=10 end loop Is there any other way to clear it? I'll try name:= " " method now though. |
Author: | corriep [ Mon May 04, 2009 6:12 pm ] | ||
Post subject: | Re: GR 11 turing help | ||
|
Author: | RyanHB [ Mon May 04, 2009 6:52 pm ] |
Post subject: | RE:GR 11 turing help |
Do I put that in the loop after the code I wrote? |
Author: | corriep [ Mon May 04, 2009 7:01 pm ] |
Post subject: | Re: GR 11 turing help |
Ok maybe I should explain the locate command. When you use "put" the text gets shown right below the last line. locate (x, y) will make it so that your text starts at the specified row/column. So if you use locate (1, 1) then you text is guaranteed to be placed in the top left corner (even if it has to over-write the previous text) |
Author: | zero-impact [ Mon May 04, 2009 7:10 pm ] |
Post subject: | RE:GR 11 turing help |
What you could also do is just store all the information somehow. (such as an array) and just redraw the entire chart each time something changes. |
Author: | RyanHB [ Mon May 04, 2009 7:27 pm ] |
Post subject: | RE:GR 11 turing help |
Corriep thanks:D.. This is what I have loop put "Enter Name: " .. get Name numname := numname + 1 put "Enter Weight: " .. get Weight locate (1, 1) put "Enter name: " .. get Name locate (2, 1) put "enter weight: " .. get Weight var check : boolean if numname = 10 then check := true else check := false end if exit when check = true end loop It works the first time but then it starts placing the text under the previous text |
Author: | corriep [ Mon May 04, 2009 7:32 pm ] |
Post subject: | RE:GR 11 turing help |
The trick is to have the locate after the FIRST put command and after that, the rest will just appear under it. Right now you don't have it after the first put. |
Author: | RyanHB [ Mon May 04, 2009 7:34 pm ] |
Post subject: | RE:GR 11 turing help |
ohh ok thank you very much |
Author: | DanTheMan [ Thu May 14, 2009 11:13 am ] |
Post subject: | RE:GR 11 turing help |
When the time comes to create the chart on the screen, a simple Text.Cls will erase it. |