Solved

Homework Alert!

Posted on 1998-04-29
3
256 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Today’s effective marketing is about coming down to the customers’ level and engaging in a whole new way. A text message is one of the most effective and influential ways that you can engage your customers. Here are eight ways that you can utilize t…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

717 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