arrays 
Author Message
 arrays

Quote:

>ST>i'm a Pascal newbie going to rutgers. HELP! i know one cannot read or
>ST>write a whole array at once. i am having trouble reading the values one
>ST>at a time with iteration and then writing them to the screen. i want to
>ST>be able to read numbers from the kybd one at a time into the array,
>ST>perform a type of sort and then write them out. please help.


Kim: of course you can read or write a whole array at once!
The array can be multi-dimensional , i.e.: [1..100,1..50]
of byte,integer, real === etc.

type atype = array[1..10] of integer;  
var  adata : atype;                            
       afile : file of atype;
       i : integer;
begin
   assign(afile,'TEST.DAT');
   rewrite(afile);
   fillchar(adata,sizeof(adata),0);  {****}
   write(afile,adata);                      
   close(afile);
end.

***** here's where you clear out your array, then do a loop or
something similar to load your data into the array:
  for i := 1 to 10 do
    begin
    write('ENTER ITEM: ',i);
    readln(adata[i]);
    end;

then save it:
   write(afile,adata);
   close(afile); and so on.




Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Array of Array

2. move INTERBASE ARRAY to DELPHI ARRAY ?

3. lgarray0.zip TP unit for huge arrays and arrays of sorted strings

4. floating point arrays and C arrays - HELP ME

5. Help! array of type array

6. Resizing arrays and multi-dimentional arrays of *ALL* types...

7. Is an "array of arrays" possible?

8. Remove items from array w/o making another array?

9. FIBPlus, Interbase and array fields

10. save mutiple writeln's into an array

11. Add and delete items from arrays

12. problem passing array values.

 

 
Powered by phpBB® Forum Software