3.6. Acme Getadate Pty Ltd.   

Computer Dating Service example.


algorithm example
type
mstatus=(divorced,married,single,widowed,separated)
hcolour=(blonde,brunette,bald,redhead,mousey)
eyecolour=(hazel,blue,brown,green,grey)
sexstatus=(male,female)
answer=(does,doesnt,occasionally)
preference=(like,loathe,dontcare)
string=array[1.. ??] of char
/* complex data structure */
client=record
mstat:mstatus
hcol,hpref:hcolour
icol,ipref:eyecolour // THESE FIELDS WILL BE FILLED
sex,sexpref:sexstatus // BY ANSWERS TO QUESTIONS.
smoke,drink:answer
smokepref,drinkpref:preference
name:string
end
records = file of client /* File full of client type records */
var temp, person, mate:client
dossier :records
begin
/* Ask applicant questions to create values in each field of record of
variable PERSON */.
/* OPEN up FILE of clients and start getting each client into var temp */
/* Compare each field for degree of match:
if person prefers blondes and temp is blonde then
give temp a rating.
Total ratings for each field. */
/* Do this for every client in file - keeping a copy of best match in mate
i.e. mate temp if better match than previous mate. */
/* We have best match in mate: Who is mate? */
/* Print out mates name, address plus bill for dating service. */
end.

The above can be expanded to include many attributes of the applicant.