Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 For loop help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
LupineZ




PostPosted: Fri Jan 17, 2014 7:28 pm   Post subject: For loop help

What is it you are trying to achieve?



What is the problem you are having?
<The colors don't match on the output, which leads to mis calculation>


Describe what you have tried to solve this problem



Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<setscreen ("graphics:640;480")
var num1, num2 : int
num1 := 9
var guess : int


for xcount : 1 .. 7
num1 := 9

if num1 = 9 then
drawfilloval (300, 400, 10, 10, 13) %1
drawfilloval (330, 400, 10, 10, 13) %2
drawfilloval (360, 400, 10, 10, 13) %3
drawfilloval (300, 370, 10, 10, 13) %4
drawfilloval (330, 370, 10, 10, 13) %5
drawfilloval (360, 370, 10, 10, 13) %6
drawfilloval (300, 340, 10, 10, 13) %7
drawfilloval (330, 340, 10, 10, 13) %8
drawfilloval (360, 340, 10, 10, 13) %9
end if
end for


%second numbers
for icount : 1 .. 7
randomize
randint (num2, 1, 4)
if num2 = 1 then

delay (500)
drawfilloval (300, 250, 10, 10, black) %1


elsif num2 = 2 then

delay (500)
drawfilloval (300, 250, 10, 10, 13) %1
drawfilloval (330, 250, 10, 10, 13) %2
elsif num2 = 3 then

delay (500)
drawfilloval (300, 250, 10, 10, red) %1
drawfilloval (330, 250, 10, 10, red) %2
drawfilloval (360, 250, 10, 10, red) %3

elsif num2 = 4 then

delay (500)
drawfilloval (300, 250, 10, 10, yellow) %1
drawfilloval (330, 250, 10, 10, yellow) %2
drawfilloval (360, 250, 10, 10, yellow) %3
drawfilloval (300, 220, 10, 10, yellow) %4


end if


locatexy (300, 100)
get guess %user input
if guess = num1 + num2 then
locatexy (300, 50)
put "correct"
elsif guess not= num1 + num2 then
locatexy (100, 50)
put "incorrect"
end if
end for




>

Turing:


<Add your code here>



Please specify what version of Turing you are using
<Answer Here>
Sponsor
Sponsor
Sponsor
sponsor
Dreadnought




PostPosted: Fri Jan 17, 2014 10:09 pm   Post subject: Re: For loop help

It's not clear what is actually the problem (what is supposed to happen, what is different?). It would be nice if you could clarify what the issue is.

Maybe cls is what you're looking for?
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: