Algoma University College
Computer Science 3127
Programming Languages
Fall 1996/97
Assignment #2
Pawan Lingras

Date Due: Week 5
Use a word processor and give your submissions a professional look.

  1. Describe how the break, continue and return provide some of the flexibility of goto statements within the context of structured programming.
  2. Consider the following program:
    //P
    if(E1)
    	s1();
    else
    	while(E2)
    		if(E3)
    			s2();
    		else
    			s3();
    //Q
    

    Write down the pre and post conditions for s1(), s2(), and s3(), so that you can prove that Q is the postcondition for the above program segment given P as the precondition.
  3. Read the book and briefly compare arrays in Pascal and C++.
  4. Given int a[7][7]; write down the addresses of a[3][4], a[4][3], a[5][2], a[2][5]. Remember that the array name a is the address of the first element.