?
Solved

Homework Alert!

Posted on 1998-04-29
3
Medium Priority
?
257 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 600 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Learn how to use the free Acronis True Image app to easily transfer data between iPhones and Android phones.
The top devops trends for 2017 are focused on improved deployment frequency, decreased lead time for change and decreased MTTR.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

770 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