Board index » delphi » Help required with Record Swap in Pascal - Test3.pas (0/1)

Help required with Record Swap in Pascal - Test3.pas (0/1)

Quote
Paul <gra...@grabme.screaming.net> wrote:
> Please can someone take a look at the attached program, try to Compile
> and see where I am going wrong.

You are going wrong in posting a program as an attachment - many of us can't
even see it, and it violates the structure and FAQ of the group. Please post
the source code as part of your message; then we will be able to help you.

--
______________________________________________________________________
     The Scarlet Manuka,      |        Nitpickers' Party motto:
  Pratchett Quoter At Large,  |  "He who guards his lips guards his
 First Prophet of Bonni, is:  |  soul, but he who speaks rashly will
   sa...@maths.uwa.edu.au     |    come to ruin." -- Proverbs 13:3
______________________________|_______________________________________

 

Re:Help required with Record Swap in Pascal - Test3.pas (0/1)


Quote
Paul <gra...@grabme.screaming.net> wrote:

|I urgently require some assistance in getting a Record field swap
|procedure to work using Pascal. Everytime I try to Compile the Program
|I get a Type Mismatch but cannot see where I am going wrong(yet).

|Please can someone take a look at the attached program, try to Compile
|and see where I am going wrong.

There are too many little problems to find your real problem for sure.
Make corrections as described below, then if you still have problems,
send your revised code and I will try to help.

Phil

1.  Datatype and integer are not type-compatible.  You cannot pass an
integer to a procedure that requires a parameter of type Datatype.
(I'm not sure that you do)

2.  You should never use the same name in more than one way.  You have
a field Marks:Marktype in your RecordType, then you use
Marks:Markstype in procedure definitions.  Legal but confusing.

3.  Do not reuse Borland procedure or variable names.  You define a
Swap procedure.  Borland already has one.  Legal but confusing.

4. Your swap procedure takes 2 parameters of type MarksType, but you
call it with Marks[loop] which is a DataType.  (this is the reason for
the compiler error)

5.  Your call to swap has too many ")".  It should be:

 swap (Marks[loop],Marks[loop+1]);

Other Threads