cpp3_code_x08 - CGS-2421 C+ EXAM 3 CODING PART SUMMER 2008...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CGS-2421 C++ EXAM 3 CODING PART SUMMER 2008 Name ______________________________________ Username _____________________ 1. (10pts) Add a new method called quadrant to the Point class. This method will return the quadrant that the point is located in. Quadrant 1: x>0, y>0 Quadrant numbers increase counter-clockwise. class Point { private: double x; double y; public: ... int quadrant(void); }; Sample run: Point p2(-1.6, 2.3); cout << "p1 is in quadrant " << p1.quadrant(); Output: p1 is in quadrant 2 --------------------------------------------------------- Your Solution ------------------------------------------------------- int Point::quadrant(void) { if (x>0 && y>0) return 1; if (x<0 && y>0) return 2; if (x<0 && y<0) return 3; if (x>0 && y<0) return 4; }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Name ______________________________________ Username _____________________EX3 2.(20pts) Write a function called findMax() that will find a maximum number in a 2-dimensional array(matrix) within a specified area. We assume there are at most 100 columns in the 2-D array.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/05/2011 for the course CGS 2421 taught by Professor Onal during the Fall '09 term at University of Florida.

Page1 / 4

cpp3_code_x08 - CGS-2421 C+ EXAM 3 CODING PART SUMMER 2008...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online