// function prototypes
int F(int& x, int& y);
void G(int N, int& M);
void Boxes(int A, int B);
void Ovals(int x, int y, int A, int B);
// function definitions
void main()
{ // open text and drawing windows
BigSquarePair();
//Problem 1-----------------------
for (int L = 0; L <= 360; L = L+40){
MoveTo(L, 400);
LineTo(L + 20, 360);
}
Boxes(10, 20);
Boxes(40, 120);
int size1 = 20, size2 = 40;
for (int x = size2; x < 300; x = x + size1 + size2 )
Ovals(x, 220, size1, size2);
//Problem 2-----------------------
int x = 5;
cout << "Problem 2" << endl;
cout << "x = " << x << endl;
G(3, x);
cout << "x = " << x << endl;
x = 3;
cout << "x = " << x << endl;
G(5, x);
cout << "x = " << x << endl;
cout << endl;
//Problem 3-----------------------
{
int x = 1, y = 5, z;
cout << "Problem 3" << endl;
// setw(5) is to make columns line up.
cout << setw(5) << "j" << setw(5) << "x" << setw(5) << "y" << setw(5) << "z" << endl;
for (int j = 1; j <=5; j++){
z = F(x, y);
cout << j << setw(5) << x << setw(5) << y << setw(5) << z << endl;
}
cout << endl;
}
//Problem 4-----------------------
{
int x = 1;
int y = 3;
cout << "Problem 4" << endl;
cout << setw(5) << "j" << setw(5) << "x" << setw(5) << "y" << endl;
for (int j = 1; j <=5; j++){
x = F(x, y);
cout << j << setw(5) << x << setw(5) << y << endl;
}
}
PressReturn();
} // end main
int F(int& x, int& y){
if (x < y){
x = 2*x;
return y;
}
else{
y = 2*y;
return x;
}
}
void G(int N, int& M){
int P = 1;
for (int k = 1; k <= N; k++)
P = M*P;
M = P;
}
void Boxes(int A, int Y){
int W = 400 / A;
int X = 0;
for (int I = 0;
X + W < 400;
X += 2*W){
PaintRect(X, Y, X+W, Y+W);
W += 20;
}
}
void Ovals(int x, int y, int A, int B){
FrameOval(x-A, y-B, x+A, y+B);
FrameOval(x-B, y-A, x+B, y+A);
}

Problem 5: Assume the following declarations:
int score, number; double angle; char response, ch; bool tired, done;Construct a logical expression to represent each of the following conditions:
Problem 6: Write a C++ function min that returns the smallest of 3 int arguments.
Problem 7: Write a C++ function GetCircleData that:
void extremes(int& min, int& max, int A[], int n);Last Updated: October 19, 1997 8:09 pm by