[Oberon] identity of two VARs
jan verhoeven
jan at verhoeven272.nl
Wed Sep 14 20:58:26 CEST 2005
Op Wednesday 14 September 2005 17:48 schreef shark at gulfnet.sd64.bc.ca:
> Here is a simple problem which I've never had to solve until now.
>
> PROCEDURE Identical*(VAR source, target: ARRAY OF CHAR):integer;
> (* Return 0, 1, 2 or 3 according to identity of location and
> identity of content strings. *)
> VAR
> identicallocation, identicalcontent: INTEGER;
> BEGIN
> IF ?? THEN (* source and target are the same array *)
> identicallocation := 1 ELSE identicallocation := 0
> END;
> IF source = target THEN (* the strings in source and target match. *)
> identicalcontent := 1 ELSE identicalcontent := 0
> END;
> RETURN((2*identicalcontent)+identicallocation)
> END Identical;
>
> More briefly,
> PROCEDURE Identical*(VAR source, target: ARRAY OF CHAR):integer;
> BEGIN
> RETURN((2*(source=target))+??)
> END Identical;.
>
> What should I put in place of ?? to have this work?
This looks like C++, not like a Wirthian language. With a contest to match.
--
Met vriendelijke groeten
Jan Verhoeven
http://fruttenboel.verhoeven272.nl
More information about the Oberon
mailing list