COM 1100 Professor Fell Quiz 9A Solution

Problem 1

3 5 7
4 2 1
5 3 9

Problem 2

for (int K = 7; K < 500; K +=7)
	cout << K << endl;
cout << endl;

Problem 3

double SphereVol(double R){
	return 4/3*pi*R*R*R;
}
Problem 4
int NumLetters(string s){
	int count = 0;
	for (int K = 0; K < s.length(); K++)
		if ((('a' <= s[K]) and (s[K] <= 'z')) or (('A' <= s[K]) and (s[K] <= 'Z')))
			count ++;
	return count;
}
Problem 5

3 11
6 110
11 1011

Problem 6

01001100binary = 64 + 8 + 4 = 76decimal
01110101binary = 64 + 32 + 16 + 4 + 1= 117decimal
00001111binary = 8 + 4 + 2 + 1 = 15decimal


Last Updated: November 24, 1997 7:47 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/Q9ASolution.html