COM 1100 Professor Fell Quiz 8B November 13, 1997

```void WriteArray(int A[], int N);

void main()
{
// open text window
BigConsole();

//Problem 1----------------------------variables and assignment, cout
int x = 5, y = 7, z = 9;
cout << x << ' ' << y << ' ' << z << endl;
z = y - x;
y = x - z;
x = y - z;
cout << x << ' ' << y << ' ' << z << endl;
z = x + y;
y = x + z;
x = y + z;
cout << x << ' ' << y << ' ' << z << endl;
cout << endl;
cout << endl;

//Problem 2----------------------------------------integer arithmetic
int A = 5, B = 7, C;
C = A - (B / 3 + A)/ 2;
cout << A << ' ' << B << ' ' << C << endl;

C = 10;
cout << A++ << ' ' << B++ << ' ' << C++ << endl;
cout << A-- << ' ' << B-- << ' ' << C-- << endl;
cout << endl;

A = 5, B = 7;
C = A * (B / A) * B;
cout << A << ' ' << B << ' ' << C << endl;
cout << endl;

//Problem 3-----------------------------------------------------loops
//Write a loop with this output:
//     1 \$ 3 \$ 9 \$ 27 \$ 81 \$ 243

//Problem 4-------------------------------------------------functions
// Write a function Circumference that has argument radius of type double
// and returns the circumference of the circle with that radius. (c = 2ır)

//Problem 5-------------------------------------------------functions	// Write a function IsVowel that returns true if and only if its char argument
// is 'A', 'E', 'I', 'O' or 'U'.

//Problem 6----------------------------------------------------arrays
int AA[8] = { 3, 5, 4, 2, -1, 7, 0, 6 };

for (int J = 0; J < 8; J++)
if (AA[J] < 3) AA[J] = 3;
WriteArray(AA, 8);

for (int J = 0; J < 3; J++)
WriteArray(AA, J);
}

void WriteArray(int A[], int N){
for (int J = 0; J < N; J++)
cout << J << ' ' << A[J] << endl;
cout << endl;
}
```

Last Updated: November 16, 1997 12:46 pm by
Harriet Fell
College of Computer Science, Northeastern University
360 Huntington Avenue #161CN,
Boston, MA 02115
Internet: fell@ccs.neu.edu
Phone: (617) 373-2198 / Fax: (617) 373-5121
The URL for this document is: http://www.ccs.neu.edu/home/fell/COM1100/QUIZ/QUIZ8B.html