Computer Science Canada

Sqauring Help ><

Author:  Kira [ 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

Author:  Tony [ 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.

Author:  Nick [ 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

Author:  Kira [ Wed Nov 07, 2007 4:11 pm ]
Post subject:  RE:Sqauring Help ><

ok thanks a lot guys!


: