Name:_________________________________ COM1100 F99 Quiz 1 Fell

1. Show the output of this program. Use a window with grid on the next page for the graphics output

#include "IOTools.h"
#include "Graphics.h"

void Numbers(){
	int M, N;
	M = 5; N = 7;
	cout << M << " : " << N << endl;
	N = N - M;
	M = 2 * M + N;
	cout << M << " : " << N << endl;
	
	M = 5; N = 7;
	int S = N / M * M + N;
	int T = N * M % N;
	cout << S << " : " << T << endl;
	cout << endl;
}

void Looping(){
	int K;
	for (K = 0; K < 6; K++){
		cout << K << " * " << K << " = " << K * K << endl;
	}	
	cout << endl;
	for (K = 1; K <10; K += 2){
		cout << K << " % 5 = " << K % 5 << endl;
	}
}

void Abstract(){
	for (int x = 20; x < 200; x += 50)
		FrameCircle(x, 150, 20);
	int size = 20;
	for (int x = 10; x < 200; x += size){
		DrawLine(0, 0, x, 100);
		size += 20;
	}
}

int main(int argc, char* argv[]) {
 	GraphicsWindow GW0(200, 200);		// Build graphics window 
  	ConsolePlaceBelow(0);			// Move console below graphics window 
	MakeConsoleForeground();		// Give the console the focus

	Numbers();
	Abstract();
	Looping();

        PressReturn("\nThe main program is about to terminate\n");
        return 0;
}

2.
Write C++ code that will ask the user to enter his or her age and then reply
"I'm <whatever age the user entered> too." You may use raw input or safe input.

A sample run might look like:

How old are you? 18
I'm 18 too.

Last Updated: November 27, 1999 7:16 pm by

Harriet Fell
College of Computer Science, Northeastern University
360 Huntington Avenue #161CN,
Boston, MA 02115
Internet: com1100@harrietfell.com
Phone: (617) 373-2198 / Fax: (617) 373-5121
The URL for this document is: http://www.ccs.neu.edu/home/fell/COM1100/QUIZ/Quiz.html