Help with counted loops and character graphics.
Author |
Message |
TrainsAreTrains
|
Posted: 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
|
|
|
Insectoid
|
Posted: 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. |
|
|
|
|
|
|
|