Solved

Homework Alert!

Posted on 1998-04-29
3
252 Views
Last Modified: 2010-04-16
How many Pascal Experts it will take to answer with "Homework Alert!" as their first answer?
Please, I want to learn but I do not want  "Homework Alert" for an answer.

If Pascal did not contain contain sets for example:
type
   experts = [Kelly, Steve, Ron];
   expertSet = SET of experts;

How would I define my own abstract data type SET
by using functions and procedures?
0
Comment
Question by:gokou
  • 2
3 Comments
 
LVL 3

Expert Comment

by:jlove1
ID: 1216071
wouldn't set just be an array? what more functionality would you need.. an "in" function?
You'd just write comparsions. I'll write a unit for this if the points are upped.
0
 

Author Comment

by:gokou
ID: 1216072
Adjusted points to 200
0
 
LVL 3

Accepted Solution

by:
jlove1 earned 200 total points
ID: 1216073
here's some example source

uses dos,crt;
function inset(value : string;thisset : array of string) : boolean;
var
counter : integer;
begin;
for counter := 1 to sizeof(thisset) div sizeof(string) do
   begin
    if value = thisset[counter] then begin;
                                     inset := true;

                                     exit;
                                     end;
    writeln(counter);

    end;
    inset := false;

end;
const
myset : array[1..3] of string = ('hello','goodbye','whatever');


begin;
if inset('hello',myset) then writeln('hello is in the set');
if inset('notw',myset) then writeln('notw is in the set');

readln;
end.

in the above source, the set is just array of strings.
The array can be of any length, and the INSET function determines if the value passed to it is in the set passed to it. Give it a try in some of your own source to get the hang of it.

0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Returning BSTR from a Delphi COM .DLL 2 1,892
Delphi need modify hand cursor windows 4 561
interacting with web form 4 148
creating manifest for my dll that called from activex 6 114
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
Each year, investment in cloud platforms grows more than 20% (https://www.immun.io/hubfs/Immunio_2016/Content/Marketing/Cloud-Security-Report-2016.pdf?submissionGuid=a8d80a00-6fee-4b85-81db-a4e28f681762) as an increasing number of companies begin to…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question