Lost Password?


Go Back   CodeCall Programming Forum > Software Development > Pascal/Delphi

Pascal/Delphi Forum for discussing Borland Delphi and Pascal coding techniques, tips and tricks.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-30-2007, 08:16 AM
borny86 borny86 is offline
Newbie
 
Join Date: Nov 2007
Posts: 7
Rep Power: 0
borny86 is on a distinguished road
Exclamation Pseudo + Pointer diagram, Help from the masters

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;
"Draw a pointer diagram, with explanatory text, showing how Add_Record in Book_DB works in the case where there are no records in the database. "



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 }
My psudo code

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 11-30-2007, 12:44 PM
WingedPanther's Avatar   
WingedPanther WingedPanther is online now
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 3,391
Last Blog:
wxWidgets is NOT code ...
Rep Power: 37
WingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to behold
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 11-30-2007, 06:22 PM
borny86 borny86 is offline
Newbie
 
Join Date: Nov 2007
Posts: 7
Rep Power: 0
borny86 is on a distinguished road
Default

Thanks f

Last edited by borny86; 12-03-2007 at 07:08 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

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


All times are GMT -5. The time now is 01:52 PM.

Contest Stats

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

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 100%


Complete - Celebrate!

Ads