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

Username:   Password: 
 RegisterRegister   
 times table
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
WooFerPPK




PostPosted: Tue Oct 01, 2002 7:01 am   Post subject: times table

i have to make a program that displays a time table, now i need it to count from 12 to 1. i got this so far
code:

var gnumber : real 
put "Please enter the number"
get gnumber


for decreasing times : 12 .. 1
    locate (times, 1)
    put times, " * ", gnumber, " = ", times * gnumber
    delay (100)
end for


now i instead of it going like this
1
2
3

i want the numbers to go down like this
3
2
1

what am i doing worng?
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue Oct 01, 2002 9:14 am   Post subject: (No subject)

well here's your problem:
code:
locate (times, 1)


since you count downwards then it will first print on 12th line and go up.

what you can do is to set up a separate counter that will add 1 every time for loop starts.

code:
for decreasing times : 12 .. 1
line := line +1
    locate (line, 1)
    put times, " * ", gnumber, " = ", times * gnumber
    delay (100)
end for
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
WooFerPPK




PostPosted: Tue Oct 01, 2002 11:32 am   Post subject: (No subject)

Thanks again tony
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  [ 3 Posts ]
Jump to:   


Style:  
Search: