Solved

Homework Alert!

Posted on 1998-04-29
3
254 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
using a list of objects, Delphi 3 613
Interbase BDE 4 463
Delphi Skype API 2 1,856
Activex get website that activex running on 3 103
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

763 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