I need to make a large array for my Computing A-Level project - can you help 
Author Message
 I need to make a large array for my Computing A-Level project - can you help

I am currently studying A-Level Computing and my I am having one
problem with my practical project.
I belive it is because of the 64k array structure problem.
My cource code - if you could possibly help me is less than 30k in a
zip file and is downloadable from the address below.
Basically it is a fantasy formula one system -which works perfectly
except it won't compile a league table if there are over 47 members of
the system.
Please email me if you can possible help me - i will look out on here
for replies too.

http://www.*-*-*.com/

The problem is in the displays.pas file as this is the one that uses
the array.

Cheers
Dan.

  ============Port Online============
  THE OFFICIAL SOUTHPORT F.C. WEBSITE
     Sponsored by: Matt Millin Promotions
              http://www.*-*-*.com/

========Southport Football Club=======
  News, Fixtures, Results, Reports, Pics,
           AND MUCH MUCH MORE
=====Cool Sports Site Award 1998=====
    Consistently Rated #1 For Port News
               Across The World!
===Best Soccer Web Site Award 1997===
======Webmaster: Daniel Hayes======



Wed, 22 Aug 2001 03:00:00 GMT  
 I need to make a large array for my Computing A-Level project - can you help

Hi,

I did not download your code right now, so I have to guess your
problem.

Quote:
>I am currently studying A-Level Computing and my I am having one
>problem with my practical project.
>I belive it is because of the 64k array structure problem.
>My cource code - if you could possibly help me is less than 30k in a
>zip file and is downloadable from the address below.
>Basically it is a fantasy formula one system -which works perfectly
>except it won't compile a league table if there are over 47 members of
>the system.

The components of your array look pretty large. I estimate more than
1.3KB, is that correct?
There seems to be one simple solution: modify your code to use dynamic
memory.
I guess you use something like this:

Type datarec = record
                {.... 1.3 KB }
               end;

Var data: Array[1..maxmember]of datarec;

Revise it to:

Type datarec = record
                {.... 1.3 KB }
               end;
     pdata = ^datarec;

Var data: Array[1..maxmember]of pdata;

Your array becomes pretty small, but you have to initialise the
components with the 'New' procedure;

Quote:
>Please email me if you can possible help me - i will look out on here
>for replies too.

>http://www.riaft.freeserve.co.uk/Pascal/pascalcode.zip

>The problem is in the displays.pas file as this is the one that uses
>the array.

>Cheers
>Dan.

BTW, you crossposted, but you forgot to set the Fup2.
I set this to comp.lang.pascal.misc, because it is not strictly
related to Borland.

HTH,

Wilfried (from Hamburg)



Thu, 23 Aug 2001 03:00:00 GMT  
 I need to make a large array for my Computing A-Level project - can you help
On Sat, 06 Mar 1999 23:45:34 GMT, Robert AH Prins

Quote:



>> I am currently studying A-Level Computing and my I am having one
>> problem with my practical project.
>> I belive it is because of the 64k array structure problem.
>> My cource code - if you could possibly help me is less than 30k in a
>> zip file and is downloadable from the address below.
>> Basically it is a fantasy formula one system -which works perfectly
>> except it won't compile a league table if there are over 47 members of
>> the system.
>> Please email me if you can possible help me - i will look out on here
>> for replies too.

>> http://www.riaft.freeserve.co.uk/pascal/pascalcode.zip

>> The problem is in the displays.pas file as this is the one that uses
>> the array.

>You could have posted the offending declarations, not everyone has free
>Internet access!

>const maxsize = 47;
>userarr :array [1..maxsize] of user_record;

>user_record = record
>    PIN     :integer;
>    team_name:string;  {1}
>    user_name:string;  {2}
>    address:string;    {3}
>    county:string;     {4}
>    postcode:string;   (5}
>    driver1no:integer;
>    driver2no:integer;
>    car1no:integer;
>    car2no:integer;
>    totalu_points:integer;
>    end;

>{1} - Which Formula 1 team has a name with a length of 255 characters? {2} -
>How many people do do know with names extending to 255 characters? {3} -
>Maybe, but extremely unlikely {4} - We've got a lot of counties with 255
>characters in their names! {5} - English postcodes are famous all over the
>universe for their length. In fact we were so forward-looking that we have
>given a postcode to every particle in this universe and to every particle in
>the about 10^170 others...

>HTH,

>Robert

Thanks for your reply - however sarcastic - but it didn't work

Dan.



Thu, 23 Aug 2001 03:00:00 GMT  
 I need to make a large array for my Computing A-Level project - can you help

Quote:

> Thanks for your reply - however sarcastic - but it didn't work

> Dan.

Dan,

It look like you'll need to bite the bullet and learn about pointers and
dynamic memory allocation. It's a very interesting and useful subject
(in fact I'd say it's at least 60% of programming)... and it's the one
important topic that a lot of standard courses don't cover. Look up
pointers, and dynamic storage in your text books.

You may also find that this topic then leads you onto the wonderful
subject of data structures: stacks, lists, queues, rings, trees (of
millions of sorts), heaps... if you've only ever played with arrays
before, you'll probably feel a bit of an "Alice in Wonderland" effect
:-)

If you can't find much info, mail me, and I'll explain it to you.

BTW It's probably best to try a couple of smaple programs using pointers
before modifying your current assignment.

MH.

--
Martin Harvey.
http://www.harvey27.demon.co.uk/mch24/
PGP key available from above address,
or http://wwwkeys.pgp.net/



Fri, 24 Aug 2001 03:00:00 GMT  
 I need to make a large array for my Computing A-Level project - can you help
This message is for all those newbies who do not yet know that strings
do not HAVE to be 255 characters long.

: I am currently studying A-Level Computing and my I am having one problem
: with my practical project. I believe it is because of the 64k array
: structure problem.  My source code -
   <Snip.. URL omitted, relavent code inserted instead.>

TYPE
  User_Record = record
    PIN     :integer;
    team_name:string;
    user_name:string;
    address:string;
    county:string;
    postcode:string;
    driver1no:integer;
    driver2no:integer;
    car1no:integer;
    car2no:integer;
    totalu_points:integer;
  end;

CONST MaxSize = 47;
VAR UserArr :array [1..maxsize] of User_Record;

: it won't compile a league table if there are over 47 members of the system.

On Sat, 06 Mar 1999 23:45:34 GMT, Robert AH Prins replied:

Quote:
> {1} - Which Formula 1 team has a name with a length of 255 characters?
> {2} - How many people do do know with names extending to 255 characters?
> {3} - An address of 255 character?  Maybe, but extremely unlikely.
> {4} - We've got a lot of counties with 255 characters in their names!
> {5} - English postcodes are famous all over the universe for their length.

Dan responded:
: Thanks for your reply - however sarcastic - but it didn't work

Dear Dan,
  Robert didn't actually tell you what to do.  He assumed that you would
know you can restrict the lenth of a string by using the type:  STRING[N]
where N is the maximum length for that string.  Your USER_RECORD data type
is 5 strings and 6 integers, so it takes up 5*256+6*2 = 1292 bytes.
Therefore you could never have more than 64K div 1292 = 50 of them in
a single memory segment.  Of course you need some of that memory segment
for your other variables, leading to the actual limitation of 47.
  Robert was (implicitly) suggesting that you change your USER_RECORD
to something like:

TYPE
  user_record = record
    PIN     :integer;
    team_name:string[50]; {Anything longer is not a name, its a resume!}
    user_name:string[30]; {Noone at our school has more than 28 letters.}
    address:string[60];   {Maximum one line of typing.}
    county:string[30];    {Longest country in my (older) dictionary is 27}
    postcode:string[10];  {Longest I've seen.  How long can they be??}    
    driver1no:integer;
    driver2no:integer;
    car1no:integer;
    car2no:integer;
    totalu_points:integer;
  end;

This record takes up only 2+51+31+61+31+11+2+2+2+2+2=197 bytes.  With no
other variables, you could have an array of 64K div 197 = 324 of these.
For safety, set:  CONST MaxSize = 300;   Is that enough?

Another idea:
  I notice that the only time you want ALL the records in memory is when
you sort them (by totalu_points).  Perhaps you should make an index array:

VAR UserArr :array [1..maxsize] of Record
      Record_Number:Integer;
      totalu_points:Integer;
    end;

With only 4 bytes, this will allow you to handle over 15000 records.
After the sort, you could use this array to rewrite your data file in
sorted order:

  For Count:=1 to Number_Of_Records do begin
    Seek(OldFile,UserArr[Count].Record_Number);
    Read(OldFile,DataRecord);
    Write(NewFile,DataRecord);
  end;

or else you could just save the record numbers to an index file telling you
in what order to read records from the main data file.  (You could even have
several index files sorting your data on different fields.)

  |\/|                          ||  Burnaby South Secondary School

Mathematics & Computer Science  ||             (Canada)

P.S.  Try to make your indenting style more consistant.  I found your code
difficult to read as you varied between no indenting, and large indents
which went right off the screen to the right.



Wed, 29 Aug 2001 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. I need to make a large array for my Computing A-Level project - can you help

2. Help needed with choosing DBMS and language for large project

3. AS Level Computing - PLEASE HELP!!

4. AS Level Computing

5. A-Level Project Help!!!

6. S.O.S. :: Porters needed for large project.

7. Help: tools for large mission critical projects development

8. Large Arrays needed

9. Need to declare a large array

10. A-Level project testers required

11. making an array a variable ? / SVGA help

12. Help! Large Array

 

 
Powered by phpBB® Forum Software