|
||||||
| Pascal/Delphi Forum for discussing Borland Delphi and Pascal coding techniques, tips and tricks. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Hi im struggeling with some excersises im intending to do.
First question ive done a Pointer diagram based on this code. Code:
NEW(NodePtr); NodePtr^.Data := Rec; NodePtr^.Next := DB.Head; DB.Head := NodePtr; DB.Size := DB.Size + 1; Second question, regarding psudo code? I've attempted to write psudo code for the following piece of code. Code:
FUNCTION Q_Present(Key : INTEGER; DB : TBookDB; VAR BookRec : TBookRec) : BOOLEAN;
VAR
Pos : INTEGER;
BEGIN
RESULT := FALSE;
Pos := 1;
WHILE (NOT RESULT) AND (Pos <= DB.Size) DO
BEGIN
IF DB.Recs[Pos].Key = Key THEN
BEGIN
RESULT := TRUE;
BookRec := DB.Recs[Pos];
END
ELSE
BEGIN
Pos := Pos + 1;
END
END
END {Q_Present};
{ REQUIRES TRUE}
{ RESULTS RETURNS number of records in DB }
Set result to false. Set position to 1. When Result = False and Position less or equal to number of records Start Set Result to True Record = Poistion of record. Else Increment Position by 1. Im new to this forum, an I would be so grateful if anyone of you could help me. btw this is not assessed its just a excesrise and really want to get a grip of it . Regards Borny ![]() Last edited by borny86; 12-03-2007 at 07:09 AM. Reason: add code tags |
| Sponsored Links |
|
|
|
|||||
|
Your pseudocode is missing the If condition.
Also, please add code tags to your code for easier reading. Your image doesn't look correct. It seems like your diagrams don't correspond to the result of the statement to their left, but to the statement above.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Programming is a branch of mathematics. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Master's Degree | Nader | The Lounge | 8 | 02-14-2008 12:05 PM |
| Issue writing to file: pointer to a class which contains pointers to other classes | Sheemer | C and C++ | 0 | 08-21-2007 02:17 AM |
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |