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

Username:   Password: 
 RegisterRegister   
 Help with counted loops and character graphics.
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
TrainsAreTrains




PostPosted: Thu Dec 03, 2015 5:11 pm   Post subject: Help with counted loops and character graphics.

What is it you are trying to achieve?
I am trying to complete this assignment.


What is the problem you are having?
Hi, I'm trying to create a counted loop with asterisks moving down to the left with a counted loop, but I have no idea how to. Here is the question Write a program that uses the locate statement in a counted loop to draw a diagonal using only the character "x". The diagonal should start at the top right of the screen and continue until it hits the bottom of the screen, with a 0.1 second delay between characters. The program will then output the word "BOOM!" at the point where the line hits the bottom.





Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)

var row:int:=1
var collumn:int:=1
locate (row, collumn)
put "x"
loop
locate (row+1, collumn+1)
put "x"
end loop
exit when row=25 and collumn=80
end loop





Please specify what version of Turing you are using
4.1.1


Thanks for the help!
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Thu Dec 03, 2015 6:27 pm   Post subject: RE:Help with counted loops and character graphics.

A counted loop is a for loop, which you haven't used in your code. Replace your loop and your row/column variables with a for loop. Your current code is mostly correct otherwise.
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: