When possible, SHOW YOUR WORK. Also, YOU MAY NOT USE A COMPILER OR ANY OTHER MATERIALS (except a pen and your brain).
0. Write your name on the top-right corner. No name, no grade, no exceptions.
1. Write the API's for apvector and apmatrix.
2. Determine precisely what the following program will print out when executed.
#include <stdio.h>
#include <iostream.h>int g2(int y, double x, int& z)
{
if (z) z++;
x = y / (--z);
cout << "g2: " << x << y << z << endl;
return x;
}int g1(int x, int& y, double& z)
{
while (z = g2(z,y,x))
x++;
cout << "g1: " << x << y << z << endl;
return x + y + z;
}void part1()
{
int x,z;
double y;x = (y = 2.5) > (z = 2.9);
z += 0.1;x = g1(x,z,y);
cout << "main: " << x << y << z << endl;
}void part2()
{
int a,b;
a = b = 12;
for (a = 3; a < a+1; a++)
{
if ((a % 2) * a >= a - 4)
continue;
if (!((b += a) % 4))
break;
}
cout << "part2: " << a << b << endl;
}void main()
{
part1();
part2();
getchar();
}