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

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




PostPosted: Tue Nov 06, 2007 10:38 pm   Post subject: Sqauring Help ><

i wanted the calculation to continue until the number the user entered is met. but when i made the program, it didn't continue...but it stopped because the number is greater than the "maxrow"...is there a way that i could make it continue and stop until the number i wanted to end with?

here is my program:

Quote:
var number : int
var reply1, reply2 : string
loop
put "Do you want to run program? (y/n) " ..
get reply1
exit when reply1 not= "y"
put "Enter the number you wanted to stop at "
get number
cls
locate (1, 1)
put "Number"
locate (1, 40)
put "Sqaure"
for i : 2 .. number
delay (300)
put i : 1
locate (i, 40)
delay (30)
put i * i
exit when i = number
end for
put "Do you want to try again? (y/n) " ..
get reply2
exit when reply2 not= "y"
cls
end loop
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue Nov 06, 2007 11:00 pm   Post subject: RE:Sqauring Help ><

setting your application's window to a greater size should increase the value of maxrow.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Nick




PostPosted: Wed Nov 07, 2007 6:22 am   Post subject: RE:Sqauring Help ><

instead of locating to i row instead locate to whatrow - 1 like so
Turing:
var number : int
var reply1, reply2 : string
loop
    put "Do you want to run program? (y/n) " ..
    get reply1
    exit when reply1 not= "y"
    put "Enter the number you wanted to stop at "
    get number
    cls
    locate (1, 1)
    put "Number"
    locate (1, 40)
    put "Sqaure"
    for i : 2 .. number
        delay (300)
        put i : 1
        locate (whatrow - 1, 40)
        delay (30)
        put i * i
        exit when i = number
    end for
    put "Do you want to try again? (y/n) " ..
    get reply2
    exit when reply2 not= "y"
    cls
end loop
Kira




PostPosted: Wed Nov 07, 2007 4:11 pm   Post subject: RE:Sqauring Help ><

ok thanks a lot guys!
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  [ 4 Posts ]
Jump to:   


Style:  
Search: