Back to table

Addition

The following is a valid µOCCAM program that performs I/O. This program reads two numbers from stdin, it then adds the first number to the second number and returns the output.

Program file: /public/cs3/web/ipptests/additionio.io

-- A simple addtion that should now work
INT a:
INT b:
INT c:
SEQ
  stdin ? a -- get variables
  stdin ? b
  SEQ
    c := a + b -- add variables
    stdout ! c  -- return variables

When provided with this input: /public/cs3/web/ipptests/additionio.in

21
21

it should generate the following output: /public/cs3/web/ipptests/additionio.out

==>42