1. Program output:

5 : 7
12 : 2
12 : 0

0 * 0 = 0
1 * 1 = 1
2 * 2 = 4
3 * 3 = 9
4 * 4 = 16
5 * 5 = 25

1 % 5 = 1
3 % 5 = 3
5 % 5 = 0
7 % 5 = 2
9 % 5 = 4

Done!
Press Return To Continue 

2.

//with raw input
int age;
cout << "How old are you? ";
cin >> age;
cout << "I'm " << age << " too." << endl;

// with safe input
int age = RequestInt("How old are you? ");
cout << "I'm " << age << " too." << endl;

Last Updated: November 27, 1999 7:26 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/QuizSolution.html