home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.pascal.borland      Borland Pascal was actually pretty neat      2,978 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,744 of 2,978   
   John Smith to All   
   Re: Tic-Tac-Toe   
   06 Jun 05 13:53:06   
   
   From: assemblywizard@gmail.com   
      
   science guy:   
      
   Here is the code to create an array and zero the array (spaces would be   
   better )   
   also, the code to write out the array should give you a clear picture of   
   accessing the two dimensional elements...   
   program tic;   
      
   USES   
      crt;   
      
   TYPE   
      ticarray = ARRAY[1..3] of ARRAY[1..3] OF INTEGER;   
      
   Var   
      t:  ticarray;   
      r, c, x:  integer;   
      
   PROCEDURE cleararray;   
      BEGIN   
         r := 1;   
         c := 1;   
         x := 0;   
         while r < 4 do   
            BEGIN   
               while c < 4 do   
                  BEGIN   
                     t[r,c] := x;   
                     c := c+1;   
                  END;   
               c := 1;   
               r := r+1;   
            END;   
      END;   
      
   PROCEDURE writearray;   
      BEGIN   
         write(t[1,1]);   
         write(t[1,2]);   
         write(t[1,3]);   
   writeln;   
         write(t[2,1]);   
         write(t[2,2]);   
         write(t[2,3]);   
   writeln;   
         write(t[3,1]);   
         write(t[3,2]);   
         write(t[3,3]);   
      
      END;   
      
   BEGIN   
      ClrScr;   
      cleararray;   
      writearray;   
   END.   
      
   "science guy"  wrote in message   
   news:1115090299.066417.226430@g14g2000cwa.googlegroups.com...   
   > Hello people. I am doing a program that uses multi-dimensional arrays   
   > to creat a tic-tac-toe program.   
   >   
   > Can anyone help me get started? Oh and should I use procedures or   
   > functions?   
   >   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca