Solved

Homework Alert!

Posted on 1998-04-29
3
250 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
Comment Utility
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
Comment Utility
Adjusted points to 200
0
 
LVL 3

Accepted Solution

by:
jlove1 earned 200 total points
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

HOW TO: Install and Configure VMware vSphere Hypervisor 6.5 (ESXi 6.5), Step by Step Tutorial with screenshots. From Download, Checking Media, to Completed Installation.
In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifi…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now