1.
Use the windows below to show the output of the following code:
// 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.