| Table of Squares 
 
	 
	
		| Author | Message |   
		| illu45 
 
  
 
 
 | 
			
				|  Posted: Thu Mar 10, 2005 8:58 pm    Post subject: Table of Squares |  |   
				| 
 |  
				| Hey guys, 
 I'm trying to make a table that lists a number, makes a space and then lists a sqaure. What I have so far is this:
 
 	  | code: |  	  | 
put "Number", "      ", "Sqaure"
 for i : 1 .. 50
 if i**2 < 100 then
 put i, "              ", i ** 2
 delay (100)
 elsif i ** 2 >= 100 then
 put i, "             ", i ** 2
 delay (100)
 end if
 end for
 
 | 
 
 The only problem with this is that I want it to move over to the right instead of scrolling. After numerous failed attempts with the locate command, I decided to scrap it adn try to only use the "        ", as  you can see above, unfortunately, I can't seem to get it to wrap around that way.
 
 Any ideas would be greatly appretiated,
 illu45
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Sponsor Sponsor
 
  
   |  |   
		|  |   
		| person 
 
 
 
 
 | 
			
				|  Posted: Thu Mar 10, 2005 9:13 pm    Post subject: (No subject) |  |   
				| 
 |  
				| can u explain wat u mean by "wrap"? |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| ssr 
 
  
 
 
 | 
			
				|  Posted: Thu Mar 10, 2005 9:33 pm    Post subject: (No subject) |  |   
				| 
 |  
				| use something like this 8)
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| ssr 
 
  
 
 
 |  |   
		|  |  |  
	  
		|  |   
		| Cervantes 
 
  
 
 
 | 
			
				|  Posted: Fri Mar 11, 2005 4:31 pm    Post subject: (No subject) |  |   
				| 
 |  
				| How about this? 
 	  | Turing: |  	  | 
var output : string
var  row := 2
var  col := 1
put "Number" , "      " , "Sqaure"
for  i : 1 . . 50 
    output := intstr ( i)  + "**2 = "  + intstr ( i * * 2)
    if  col + length ( output)  < maxcol then
        if  col + length ( output)  + length (" ~~ ")  < maxcol then 
            output += " ~~ "
        end if
        locate ( row, col)
        put  output . .
 
        col += length ( output)
    else 
        row += 1 
        col := 1
    end if
    delay (100)
end for | 
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| illu45 
 
  
 
 
 | 
			
				|  Posted: Fri Mar 11, 2005 6:23 pm    Post subject: (No subject) |  |   
				| 
 |  
				| That works pretty well, except that the Numbe/Square headings and the numbers don't line up to well... I finished it up at school today, but don't have it on me (at home now), I'll post it on Monday. |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| illu45 
 
  
 
 
 | 
			
				|  Posted: Tue Mar 15, 2005 6:35 pm    Post subject: (No subject) |  |   
				| 
 |  
				| Here's the code, as promised: 
 
 	  | code: |  	  | 
%Question 6
 var row, col : int
 row := 3
 col := 1
 put "Number", "      ", "Sqaure"
 for i : 1 .. 50
 if i ** 2 < 100 then
 locate (row, col)
 row := row + 1
 put i, "              ", i ** 2
 if row = 25 then
 row := 3
 col := col + 30
 locate (row, col)
 put "Number", "      ", "Sqaure"
 end if
 delay (100)
 elsif i ** 2 >= 100 then
 locate (row, col)
 put i, "             ", i ** 2
 row := row + 1
 if row = 25 then
 row := 3
 col := col + 30
 locate (1, col)
 put "Number", "      ", "Sqaure"
 end if
 delay (100)
 end if
 end for
 
 | 
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| ssr 
 
  
 
 
 | 
			
				|  Posted: Tue Mar 15, 2005 7:11 pm    Post subject: (No subject) |  |   
				| 
 |  
				| illu45 wrote: Here's the code, as promised:
 	  | code: |  	  | 
%Question 6
 var row, col : int
 row := 3
 col := 1
 put "Number", "      ", "Sqaure"
 for i : 1 .. 50
 if i ** 2 < 100 then
 locate (row, col)
 row := row + 1
 put i, "              ", i ** 2
 if row = 25 then
 row := 3
 col := col + 30
 locate (row, col)
 put "Number", "      ", "Sqaure"
 end if
 delay (100)
 elsif i ** 2 >= 100 then
 locate (row, col)
 put i, "             ", i ** 2
 row := row + 1
 if row = 25 then
 row := 3
 col := col + 30
 locate (1, col)
 put "Number", "      ", "Sqaure"
 end if
 delay (100)
 end if
 end for
 
 | 
lol thats what u wanted...
  |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Sponsor Sponsor
 
  
   |  |   
		|  |   
		| ssr 
 
  
 
 
 | 
			
				|  Posted: Tue Mar 15, 2005 7:47 pm    Post subject: (No subject) |  |   
				| 
 |  
				| another code 
   
 	  | code: |  	  | var c:=1
var r:=1
 for i:1..50
 r+=1
 locate (r,c)
 put i:2, "  ----->",i**2:4," |"
 if r =23 then
 c+=16
 r:=1
 end if
 end for
 
 | 
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Flikerator 
 
 
 
 
 | 
			
				|  Posted: Wed Mar 16, 2005 12:09 pm    Post subject: (No subject) |  |   
				| 
 |  
				| ssr wrote: another code
   	  | code: |  	  | var c:=1
var r:=1
 for i:1..50
 r+=1
 locate (r,c)
 put i:2, "  ----->",i**2:4," |"
 if r =23 then
 c+=16
 r:=1
 end if
 end for
 
 | 
 You knocked the shiz outa that code lolz
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		|  |  
 |