
-----------------------------------
endusto
Sun Feb 13, 2005 5:48 pm

loop question
-----------------------------------
i've checked the manual and stuff but im still not sure how to do this, i know a few other languages, like C++, java ect, and they all have "while loops" so it loops until something equals something else, how do you do that in turing?  and, how do you make it so a new variable is created every time? like i have to make something that asks how many courses you have this semester, then it will ask you what you got in each one and find the average, but i dont know how to make a new variable for each mark, if you are asked how many courses you have

-----------------------------------
Drakain Zeil
Sun Feb 13, 2005 6:05 pm


-----------------------------------
Eh? I think you want to use a for..end for, and an array.

var courses:int

get courses

var grade:array of int 1..courses

for i:1..courses
get grade(i)
end for

Is that what you wanted? (note: I haven't used turing in a while, my code code be off by a bit)

-----------------------------------
ssr
Sun Feb 13, 2005 6:09 pm


-----------------------------------
Do you want exit when
var ha :int
loop
get ha
exit when ha = 5
end loop

 8)  8)

-----------------------------------
endusto
Sun Feb 13, 2005 7:36 pm


-----------------------------------
well i want that, but i want it so like, ha1 will be your first mark, ha2 will be your second... ect.

-----------------------------------
ssr
Sun Feb 13, 2005 8:09 pm


-----------------------------------
then u have to create an array 
var times:int
put "how many marks to enter?"
get times

var lala : array 1..times of int

% this part is just in case the user skips a turn 
for ii:1..times
lala(ii) := 0
end for

for i:1..times
put "Enter the number ", i ," mark."
get lala (i)
end for

for b:1..times
put "The number ",b, " mark is ",lala (b)
end for
 :wink:  :D

-----------------------------------
1337_brad
Sun Feb 13, 2005 8:27 pm

Uhh...
-----------------------------------
Turing has while loops o.o; *I think* been a while since I turcoded but I am uite sure it does o.o;

-----------------------------------
cycro1234
Mon Feb 14, 2005 8:30 am


-----------------------------------
Turing does not have while loops

-----------------------------------
ssr
Mon Feb 14, 2005 2:55 pm


-----------------------------------
I'm just wondering,  is there anyway to create arrays or chnage it 
like depends on how many numbers the user entered, teh number of arrays are created.  :D  :D  :D 
using loops 
and blah blah 
 8)  8)

-----------------------------------
Tony
Mon Feb 14, 2005 3:13 pm


-----------------------------------
Turing does not have while loops
sure it does

loop
...
exit when not(condition)
end loop

 :wink: 
something about arrays
yes - [url=http://www.compsci.ca/v2/viewtopic.php?t=6723]Flexible Arrays


-----------------------------------
ssr
Mon Feb 14, 2005 8:32 pm


-----------------------------------
WOWOWOWOW
thanx Tony,so thats what its for
I was just wondering what a flexible array is. :D  :D

-----------------------------------
StarGateSG-1
Tue Feb 15, 2005 12:20 pm


-----------------------------------
Not to be rude but if you already know some java and C++ why are you leanring turing :?:  :?:  :?:  :arrow: 

Turing is only good if you don't know any other language at teh time :!:  :arrow: 

If it is a school course talk to your teacher about advancing your skills not back tracking  8)

-----------------------------------
ssr
Tue Feb 15, 2005 4:23 pm


-----------------------------------
I only know a little java and still learning, and I dont know any C++?
ummm

-----------------------------------
Bacchus
Tue Feb 15, 2005 11:20 pm


-----------------------------------
i think he wa stalking about endusto

-----------------------------------
ssr
Wed Feb 16, 2005 12:13 pm


-----------------------------------
Blah  :oops:  :oops: 
use lalala
anyway I like Turing..

-----------------------------------
cycro1234
Wed Feb 16, 2005 7:10 pm


-----------------------------------
Turing is great if u've never done ne programming in the past, like me :D
