COM 1100 Professor Fell Quiz 2B October 2, 1997

1. Use the windows below to show the output of the following code:
(The grid boxes are 20 pixels apart.)

// function prototypes
void NumberTask();
void DrawingTask();
void spacer();

// definitions
void main()
{
// open text and drawing windows
TinySquarePair();

// do the work here
spacer();
DrawingTask();
spacer();
NumberTask();
spacer();

PressReturn();
}

void spacer()
{
cout << "*-*-*-*-*" << endl;
}

void NumberTask(){
for (int N = 1; N <= 5; N++)
cout << N << "*" << N << " = "
        << N*N << endl;
}

void DrawingTask(){
cout <<"Drawing Rectangles"<< endl;
for (int M = 20; M < 150; M += 30)
PaintRect(M, 100, M + 20, 120);
}

2. Write a for loop that has the following output:

Today I will eat 2 apples.
Today I will eat 3 apples.
Today I will eat 4 apples.
Today I will eat 5 apples.
Today I will eat 6 apples.
Today I will eat 7 apples.
Today I will eat 8 apples.
Today I will eat 9 apples.


Last Updated: October 5, 1997 5:37 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/QUIZ2A.html